Tại sao các tab không hiển thị?

Tác giả:Đúng rồi., Tạo: 2023-07-02 22:26:16, Cập nhật: 2023-07-03 09:13:33

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)

Vào buổi chiều, tab không cập nhật dữ liệu, và vào buổi tối đột nhiên không hiển thị biểu mẫu, thật lạ.


Thêm nữa

Đúng rồi.Cảm ơn.

Các bạn có thể liên hệ với chúng tôi bằng cách nhấp vào hình ảnh trên.```LogStatus('`' + json.dumps(tab1) + '`') ``

Giấc mơ nhỏĐăng mã theo định dạng: ` ` ` Mã ` ` ` Chú ý là ký hiệu, không phải là ký hiệu. Nhìn vào mã dưới đây, điều này chỉ tạo một tab, viết dữ liệu, và cần gọi hàm LogStatus được viết trong thanh trạng thái của chính sách, xem tài liệu API.