BitBank
BitBank > Docs > API Docs

BitBank API docs

Rest API

The most up to date forecasts (featureset objects) can be queried at https://bitbank.nz/api/forecasts?secret=YOUR_API_KEY and you can also specify if your only interested in a single market pair e.g. USDT_BTC https://bitbank.nz/api/forecasts/usdt_btc?secret=YOUR_API_KEY

As these are the most up to date forecasts there will be no future data computed (what actually happened after our predictions)

For historical forecast data the past 4 hours of forecasts can be retrieved at https://bitbank.nz/api/coin/usdt_btc?secret=YOUR_API_KEY

Your API key can be found in your account

API Wrappers

Wrappers of the rest api can be found for Node.js and Python

Let us know if your interested in another language wrapper or if you create one

Web/Javascript API

We currently support web/JavaScript subscriptions to live data using google cloud Firestore/Firebase


<script src="https://www.gstatic.com/firebasejs/4.6.0/firebase.js"></script>
<script src="https://www.gstatic.com/firebasejs/4.6.0/firebase-firestore.js"></script>
<script>
  // Initialize Firebase
  var config = {
    apiKey: "AIzaSyAzimdCJNcfxWax0j3ZOxw-wGz01mh9euU",
    authDomain: "bitbank-nz.firebaseapp.com",
    databaseURL: "https://bitbank-nz.firebaseio.com",
    projectId: "bitbank-nz",
    storageBucket: "bitbank-nz.appspot.com",
    messagingSenderId: "530942804334"
  };
  firebase.initializeApp(config);
  var db = firebase.firestore();
</script>

Setting up a connection to google cloud firestore with your bitbank username and password must be done before subscribing to changes


firebase.auth().signInWithEmailAndPassword(email, password).catch(function (error) {
  // Handle Errors here.
  var errorCode = error.code;
  var errorMessage = error.message;
}).then(function (status) {
    //authenticated
});
                

Listen for all changes


db.collection("featuresets")
    .onSnapshot(function(querySnapshot) {
        //...
        var featuresets = [];
        querySnapshot.forEach(function(doc) {
            featuresets.push(doc.data().name);
        });
        // Do stuff with featuresets e.g. create graphs/trade
    }, function(error) {
        //...
    });
                

Listen for changes to a specific pair e.g. BTC_XMR (uppercase)


db.collection("featuresets").doc("BTC_XMR")
  .onSnapshot(function (doc) {
    //...
    if (!doc) {
      return
    }

    var featureset = doc.data();
    // Do stuff
  }, function (error) {
    //...
  });
                

Format of each featureset

{
  "best_ask_price": "0.05124847", // lowest ask/sell in orderbook
  "best_bid_price": "0.05120000", // highest bid/buy in orderbook
// unix timestamp it was saved in the database after we computed our projections
  "create_date": 1511466719.288839,
  "currency_pair": "BTC_ETH",
  "date": 1511466717.16772, // unix timestamp after we received data from the exchanges
// our projections of how far the weighted average in the trades
// will be from the current midpoint e.g. 1.01 meaning it will go up 1%
// over the next 0-5, 5-30, 30-60, 60-120 minutes
  "estimated_future_wavg_120": "1.00683879",
  "estimated_future_wavg_30": "1.00105642",
  "estimated_future_wavg_5": "0.99774896",
  "estimated_future_wavg_60": "1.00330539",
// our projections of what the standard deviation will be weighted by trade volume
// e.g. estimated_future_wstd_5 = .00540229 means that we predict 95% of the value traded in the next 0-5minutes will be at a price between
// 2*.00540229 (two standard deviations) above or below the mean
// this is used in the graphs to show a shaded area where we predict 95% of the value will be traded
  "estimated_future_wstd_120": "0.00607033",
  "estimated_future_wstd_30": "0.00326227",
  "estimated_future_wstd_5": "0.00540229",
  "estimated_future_wstd_60": "0.00396866",
// the actual observed weighted average in the prices of trades (weighted by amount)
// over the next 5, 30, 60, 120 minutes, if available
// this can be converted to a percentage change from midpoint and compared to estimated future wavg to see how far off our predictions where
  "future_wavg_120": null,
  "future_wavg_30": null,
  "future_wavg_5": null,
  "future_wavg_60": null,
// the actual weighted standard deviation in the trades
// over the next 5, 30, 60, 120 minutes, if available
  "future_wstd_120": null,
  "future_wstd_30": null,
  "future_wstd_5": null,
  "future_wstd_60": null,
// if future data like future_wavg_120 has been calculated
  "has_future_data": null,
  "id": 9524833,
// percent distance from weighted orderbook midpoint to best buy/sell midpoint,
// greater than 1 meaning lots of buy orders are close to the best buy
  "power_imbalance": "1.00016207",
// based on our current projection...
// what price our algorithm recommends buying at
// currently this would be at most the smallest tradable amount (0.00000001 on poloniex) above the best buy
  "recommended_buy": "0.05055391",
// estimated profit in next 2 hours after:
// making a trade at recommended buy and then trading back, assumes 0.25% maker trading fee
  "recommended_buy_profit": "1.01045877",
  "recommended_sell": "0.05231084",
  "recommended_sell_profit": "1.01406126",
// spread between best buy/sell
  "spread_percent": "1.00094668",
// weighted average in the trades distance to best buy/sell midpoint
  "wavg_distance_to_midpoint_percent30min": "-0.00152337",
  "wavg_distance_to_midpoint_percent5min": "-0.00230549",
  "wavg_distance_to_midpoint_percent60min": "-0.00109793",
  "weighted_trade_average30min": "0.05114632",
  "weighted_trade_average5min": "0.05110641",
// 60 currently is actually 2 minutes here
  "weighted_trade_average60": "0.05116806",
// r values are unpopulated currently
  "weighted_trade_r_value30min": "0.00000000",
  "weighted_trade_r_value5min": "0.00000000",
  "weighted_trade_r_value60": "0.00000000", // 2 minute
// slope in terms of price change over time (change per second) (NOT percent price change over time)
// based on fitting a line weighted by trade amount
// This line can be noisy for markets where there are not many trades
// e.g. if there are only very different trades close together the line might be extreme
  "weighted_trade_slope30min": "-0.00000022",
  "weighted_trade_slope5min": "0.00000076",
  "weighted_trade_slope60": "0.00000161" // 2 minutes

}
                

Also checkout our bulk crypto forecast data to get this data in a different format e.g. csv ect