0
Follow
1
Followers
Pourquoi l'onglet ne s'affiche-t-il pas ?
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)
C'est étrange, il n'y a plus de tableaux le soir, il n'y a plus de tables le soir, il n'y a plus de tableaux le soir, il n'y a plus de tableaux le soir, il n'y a plus de tableaux le soir.
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)MyLanguage DocFMZ PINE Script DocNotes & Explanation of Futures Reverse Doubling Algorithm StrategySolutions to Obtaining Docker Http Request Message
Comment
All comments (3)
贴代码格式为:
```
代码
```
注意是`符号,不是'符号。
看了下代码,这个只是创建了一个tab ,写了数据,还需要调用LogStatus 函数写在策略的状态栏,具体可以参看API文档。
3 years ago
- 1

