Type/to search
0
Follow
1
Followers
La fonction getposition ne peut obtenir que les informations de position de la première paire de contrats. Puis-je utiliser une boucle for pour obtenir les informations de position de plusieurs paires...
Help
Created 2021-10-16 21:24:27  
 14
 1227

Par exemple, si j'ai mis en place plusieurs paires de contrats, et que je n'ai pu obtenir des informations sur la position que pour le premier contrat, comment puis-je obtenir des informations sur la position pour les autres paires de contrats ?

Related Recommendations
Comment
All comments (14)

    哥们,有没有联系方式,我也是刚开始做这个,一起探讨一下

    5 years ago

    在平台上可以一起探讨啊,我基本小白,估计也帮不到你什么。。

    5 years ago

    泪流满面,终于自己解决掉了,给大家分享一下修改后的代码:
    def main():
    for i in range(len(exchanges)):
    exchanges[i].SetContractType("swap")
    R = exchanges[i].GetRecords()
    P = exchanges[i].GetPosition()
    Log(R)
    Log(P)

    5 years ago

    我可能发现了bug,相同程序,okex可以读取到多个交易对参数,但是在币安交易所上,只能读取到第一个交易对的数据

    5 years ago
    javascript
    function main() { for (var i = 0 ; i < exchanges.length ; i++) { var pos = exchanges[i].GetPosition() Log(exchanges[i].GetName(), exchanges[i].GetCurrency(), "pos:", pos) } }
    5 years ago

    不止是模拟,实盘的时候只能读取第一个交易对数据,后面的交易对数据读取是时会显示错误: Invalid ContractType

    5 years ago

    切换交易对要重设合约。每个交易所对象至少 设置一次合约。

    5 years ago

    自己解决掉了,哈哈

    5 years ago

    老板,牛啤!

    5 years ago

    多个交易对,只能读取到第一个红色的,后面绿色的都不行

    5 years ago

    请问如何重设合约呢?这个问题卡了我好几天了。。

    5 years ago

    还是有问题,模拟回测选择币安交易所,分别是btc 与ETH交易对,程序只能获取btc行情数据,报错:品种订阅失败 ETH_USDT_Futures_Binance
    我的程序如下:
    def main():
    exchange.SetContractType("swap")
    for i in range(len(exchanges)):
    R = exchanges[i].GetRecords()
    P = exchanges[i].GetPosition()
    account = exchange.GetAccount()
    Log(R)
    Log(P)
    Log(account)

    5 years ago

    回测时间不要太早。

    5 years ago

    记得切换exchange对象

    5 years ago
  • 1
Forums
PINE Language
Get the app
iPhone Download
© 2015 - ∞ INVENTOR PTE LTD (SG)