Binance: Is for order-book and old-trade-lookup-market_data no implicit call available?
I try to call: https://binance-docs.github.io/apidocs/spot/en/#order-book and https://binance-docs.github.io/apidocs/spot/en/#old-trade-lookup-market_data
with the following code:
const response = await exchange.apiGetDepth ({ 'recvWindow': 60000, 'symbol': 'ETHBTC', })
const response = await exchange.apiGetHistoricalTrades ({ 'recvWindow': 60000, 'symbol': 'ETHBTC', })
But in both cases, I get an "is not a function" error. Is this because, for example, order-book is already unified in the fetchOrder() call? Are functions that are unified not accessible through implicit calls in general?
Hello @MalteToenjes,
Nop, every endpoint is available through the implicit API, as long as we follow the API structure defined for that exchange in CCXT.
In this case, you would need to use:
const response = await exchange.publicGetDepth ({ 'symbol': 'ETHBTC' })
const response2 = await exchange.publicGetHistoricalTrades ({ 'symbol': 'ETHBTC'})
Moreover, you don't need to provide recvWindow either; ccxt will add it automatically.
Please read more about the implicit API here: https://docs.ccxt.com/en/latest/manual.html#implicit-api-methods
Hey thanks for you answer.
But I'm a little bit confused. Regarding to the endpoint https://binance-docs.github.io/apidocs/spot/en/#lending-account-user_data
the call should be:
const response = await exchange.privateGetLendingUnionAccount()
But it is
const response = await exchange.sapiGetLendingUnionAccount()
@MalteToenjes Yep, the structure might vary from endpoint to endpoint, so it is not a "linear" format. You can always search inside the exchange object for the implicit method you want by doing something like this:
let exchange = new ccxt.binance({});
const unionEndpoints = Object.keys(x).filter(prop => prop.includes("Union")) // use some distinctive keyword of the endpoint here
console.log(unionEndpoints);