22
Follow
19
Followers
Eu escrevi um código para monitorar se as encomendas estão sendo processadas, e obtive dados de encomendas da plataforma de negociação, usando o exchange.GetOrders ();
Depois, um intervalo de 1000 milissegundos.
Mas a plataforma sugere:
Erro
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."}
Como resolver este problema?
Como é que podemos fazer isso sem usar o código abaixo?
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)

