Type/to search
0
Follow
1
Followers
ٹیب کیوں نہیں دکھائی دے رہا ہے؟
Help
Created 2023-07-02 22:26:16  Updated 2023-07-03 09:13:33
 3
 996
python
import json import pandas as pd def main(): while True: # tab1['rows'].clear() tab1 = { "type": "table", "title": "主账户", "cols": ["货币对", "方向","持仓均价","持仓数量","冻结保证金","盈亏状态"], "rows": [] } tab2 = { "type": "table", "title": "附属账户", "cols": ["货币对", "方向","持仓均价","持仓数量","冻结保证金","盈亏状态"], "rows": [] } data = exchanges[0].IO("api", "GET", "/fapi/v2/account") # 筛选出有持仓的数据 positions_with_holdings = [position for position in data['positions'] if float(position['positionAmt']) != 0] df = pd.DataFrame(positions_with_holdings) for i in range(len(df)): Log(df.loc[i, 'symbol'],df.loc[i, 'positionSide'],df.loc[i, 'entryPrice'],df.loc[i, 'positionAmt'], df.loc[i, 'initialMargin'],df.loc[i, 'unrealizedProfit']) tab1["rows"].append([df.loc[i, 'symbol'],df.loc[i, 'positionSide'],df.loc[i, 'entryPrice'],df.loc[i, 'positionAmt'], df.loc[i, 'initialMargin'],df.loc[i, 'unrealizedProfit']]) data_2 = exchanges[1].IO("api", "GET", "/fapi/v2/account") # 筛选出附属账户有持仓的数据 positions_with_holdings_2 = [position for position in data_2['positions'] if float(position['positionAmt']) != 0] df_2 = pd.DataFrame(positions_with_holdings_2) #tab2['rows'].clear() for i in range(len(df_2)): tab2["rows"].append([df_2.loc[i, 'symbol'],df_2.loc[i, 'positionSide'],df_2.loc[i, 'entryPrice'],df_2.loc[i, 'positionAmt'], df_2.loc[i, 'initialMargin'],df_2.loc[i, 'unrealizedProfit']]) Sleep(2000)

دوپہر کے وقت ٹیب کو اپ ڈیٹ نہیں کیا جاتا ہے اور شام کو اچانک ٹیب کو اپ ڈیٹ نہیں کیا جاتا ہے، عجیب بات ہے

Related Recommendations
Comment
All comments (3)

    谢谢哈

    3 years ago

    LogStatus('`' + json.dumps(tab1) + '`')

    3 years ago

    贴代码格式为:
    ```
    代码
    ```

    注意是`符号,不是'符号。

    看了下代码,这个只是创建了一个tab ,写了数据,还需要调用LogStatus 函数写在策略的状态栏,具体可以参看API文档。

    3 years ago
  • 1
iPhone Download
Forums
PINE Language
© 2015 - ∞ INVENTOR PTE LTD (SG)