Fee Summary
Select any exchange and start.
JavaScriptOther
Select any exchange and start.
Source JavaScript
function main() {
const binanceFundingRate = {
type: 'table',
title: 'Binance Fees',
cols: ['Trading pair', 'Index price', 'Mark price', 'Basis', 'Funding rate', 'Rate time''],
rows: []
};
const gateFundingRate = {
type: 'table',
title: 'GateIORate',
cols: ['Trading pair', 'Index price', 'Mark price', 'Basis', 'Funding rate', 'Rate time''],
rows: []
};
const okexFundingRate = {
type: 'table',
title: 'OKEXRate',
cols: ['Trading pair', 'Index price', 'Mark price', 'Basis', 'Funding rate', 'Rate time''],
rows: []
};
while (true) {
const data = JSON.parse(HttpQuery('https://fapi.binance.com/fapi/v1/premiumIndex'));
binanceFundingRate.rows = data.map(({ symbol, lastFundingRate, markPrice, indexPrice, nextFundingTime }) => [
symbol,
indexPrice,
markPrice,
_N((+markPrice - indexPrice) / +indexPrice * 100, 4) + '%',
_N(lastFundingRate * 100, 4) + '%',
_D(nextFundingTime)]);
const dataGate = JSON.parse(HttpQuery('https://api.gateio.ws/api/v4/futures/usdt/contracts'));
gateFundingRate.rows = dataGate.map(({ name, funding_rate, mark_price, index_price, funding_next_apply }) => [
name,
index_price,
mark_price,
_N((+mark_price - index_price) / +index_price * 100, 4) + '%',
_N(funding_rate * 100, 4) + '%',
_D(funding_next_apply * 1000)]);
const instruments = JSON.parse(HttpQuery('https://www.okex.com/api/swap/v3/instruments'));
okexFundingRate.rows = [];
instruments.map(a => a.instrument_id).forEach(instrument_id => {
const item = JSON.parse(HttpQuery(`https://www.okex.com/api/swap/v3/instruments/${instrument_id}/funding_time`))
okexFundingRate.rows.push([instrument_id, '-', '-', '-', _N(item.funding_rate * 100, 4) + '%', _D(new Date(item.funding_time))]);
});
LogStatus('\n`' + JSON.stringify([binanceFundingRate, gateFundingRate, okexFundingRate]) + '`\n');
Sleep(60000);
}
}Published by yulong on the FMZ strategy square · last modified 2021-02-06. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.
Build this with AgenKit
A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Fee-Summary.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- Get tests, backtest, risk controls and a paper-trading switch
Understand it first
Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.