이 모든 것은 우리가 할 수 있는 일입니다.

저자:라이트플라이, 2021-03-10 21:02:32
태그:도구

대부분의 사람들이 사용했던 position = exchanges[0].GetPosition ((() avgPrice = 위치[0][Price] 그러나 실제로는 금지되어 있으며, 비트코인 계약 위치 정보를 인쇄합니다: [map[Amount:5 ContractType:swap FrozenAmount:0 Info:map[entryPrice:55173.32071038 isAutoAddMargin:false isolatedMargin:0.00000000 isolatedWallet:0 leverage:20 liquidationPrice:0 marginType:cross markPrice:55171.20000000 maxQty:50 notionalValue:-0.00906269 positionAmt:-5 positionSide:BOTH symbol:BTCUSD_PERP unRealizedProfit:0.00000034] Margin:0.0004531349689693174 MarginLevel Price:20:55173.32071038 Profit:3.4e-07:1]]

두 가지 가격인 엔트리 프라이스 프라이스가 발견되었고, 계약 거래는 다른 거래소에서 매일 결제되며, 결제 후 가격은 변합니다. 엔트리 프라이스가 진정한 원본 보유 가격이며, 만약 당신이 이 때 수익률을 계산하기 위해 가격으로 손해를 막는 것을 시도한다면 더 큰 손실이 발생할 수 있습니다.

이러한 이유로, 3대 거래소의 지분평등 함수를 포장하고, 가져갈 수 없습니다.


def  getAvgPrice(position):
    if hasattr(position[0],'Info') and hasattr(position[0].Info,'cost_open'):# Huobi
        return position[0].Info.cost_open
    elif hasattr(position[0],'Info') and  hasattr(position[0].Info,'avg_cost'):#OKex
        return position[0].Info.avg_cost
    elif hasattr(position[0],'Info') and  hasattr(position[0].Info,'entryPrice'):#binance
        return position[0].Info.entryPrice
    else:
        return position[0]["Price"] 

def main():
    Log(exchange.GetAccount())
    position = exchanges[0].GetPosition()
    if len(position)>0:
        avgPrice = getAvgPrice(position)
        Log(avgPrice)
    
    


관련

더 많은

okTrade이건 유용해. 가져가. 하지만 저는 그것을 바꾸었습니다. 이 글은 이쪽에서 작성되었습니다. if hasattr ((postinInfo,'Info') and hasattr ((postinInfo.Info,'cost_open'): # Huobi return postinInfo.Info.cost_open elif hasattr ((postinInfo,'Info') and hasattr ((postinInfo.Info,'avg_cost'): #OKex return postin 정보.정보.평균_비용 elif hasattr ((postinInfo,'Info') and hasattr ((postinInfo.Info,'entryPrice'): #binance return postinInfo.Info.entryPrice else: [Price]

노력하는 양성강인함

q631207207만약 C로봇을 사용해서 계속 저장 정보를 팝업하는 거라면, 좀 도와줄 수 있을까요?

라이트플라이당신은 스스로 순환을 습니다.