क्या आप सही हैं कि आप एक समान मूल्य पर स्टॉक खरीद रहे हैं?

लेखक:लाइटफ्लाय, दिनांकः 2021-03-10 21:02:32
टैगःऔजार

एक समान मूल्य प्राप्त करने के लिए अधिकांश लोग उपयोग करते हैं position = exchanges[0].GetPosition ((() avgPrice = position[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 Type-07:1]]

यह पता चला है कि दो कीमतें हैं प्रवेश मूल्य मूल्य, जबकि अनुबंध लेनदेन के लिए विभिन्न एक्सचेंजों पर हर दिन निपटान किया जाता है, और निपटान के बाद मूल्य बदल जाता है, और प्रवेश मूल्य वास्तविक मूल स्टॉक मूल्य है। यदि आप इस समय मूल्य का उपयोग करके लाभ की गणना करने के लिए स्टॉप-लॉस करते हैं, तो आपको अधिक नुकसान हो सकता है।

इन कारणों के लिए, तीन बड़े एक्सचेंजों के लिए स्टॉक के समान मूल्य फ़ंक्शन को पैक किया गया है, और इसे नहीं लिया जा सकता है।


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)
    
    


संबंधित

अधिक

ओके ट्रेडयह काम करता है। इसे ले लो। लेकिन कुछ बदल गया है। def getAvgPrice ((postinInfo): 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 postinInfo.Info.avg_cost elif hasattr ((postinInfo,'Info') and hasattr ((postinInfo.Info,'entryPrice'): #binance return postinInfo.Info.entryPrice else: return postinInfo ["मूल्य"]

परिश्रम करनाक्रूर

q631207207क्या आप यह देखने में मदद कर सकते हैं कि क्या _C रोबोट का उपयोग करके स्टॉक की जानकारी लगातार पॉप अप होती है?

लाइटफ्लायआप खुद ही इस चक्र में फंस गए हैं।