22
Follow
19
Followers
我写了一个监测挂单是否成交的代码,从交易平台获取订单数据,使用了 exchange.GetOrders();
然后间隔为1000毫秒。
但平台提示:
错误
GetTicker: {"code":-1003,"msg":"Too many requests; current limit of IP(8.216.89.72) is 2400 requests per minute. Please use the websocket for live updates to avoid polling the API."}
请问如何解决这个问题?
如果不用下面这段代码,还有什么其他的办法?
function main() {
setContract(); // 设置合约
initDatas(); // 初始化数据
initialize(); //检查是否存在多单和空单
while (true) {
////监测交易平台的订单是否成交
var orders = exchange.GetOrders();
if (orders) {
for (var i = 0; i < orders.length; i++) {
if (orders[i].Status === ORDER_STATE_CLOSED) {
Log('挂单已成交: id=', orders[i].Id, '成交价:', orders[i].Price, '成交量:', orders[i].Amount);
calculateProfit(ticker); //统计收益****
}
}
}
else { Log("获取订单失败,返回值为null"); }
////监测从TradingView发出的WebHook消息
var command = GetCommand(); //获取WebHook消息
if (command) {// 如果有消息,则执行命令
Log("接收到的命令:", command, "#FF1CAE");
TV_FMZ_Strategy(command); //开单平单操作
}
Take_Profit_Stop_Loss(); //止盈止损操作
Sleep(_Interval); // 程序运行间隔
}
}
Related Recommendations
Inventor Quant Workflow FAQ (Continuously Updated)Financial Magic Zone Global KOL RecruitmentFAQ Summary (Updating...)PINE Language Introductory Tutorial of FMZ QuantPrimary Tutorial of Strategy Writing with FMZ Quant Trading Platform (Must Read)Getting Started with FMZ Quant Trading Platform (Must Read)

