avatar of xaifer48 xaifer48
집중하다 사신
8
집중하다
0
수행원

무역거래량 분류 및 통계에 대해 전문가들에게 질문하고 싶습니다.

만든 날짜: 2022-08-18 12:56:23, 업데이트 날짜: 2022-08-20 16:07:39
comments   4
hits   842

신들여, 저는 어떤 주기 K선에서 거래량을 두 종류의 구매와 판매를 구분해서 계산하고 싶습니다. 예를 들어 1분 주기 K선 그래프에서, 각 K선에서 해당되는 거래량 중 각각 2가지 유형의 구매와 판매의 거래량은 얼마입니까? 제 생각에는 새로운 K 라인이 생성되지 않을 때, 트레이드 데이터를 가져와 축적하고, 새로운 K 라인이 생성되면, 축적된 트레이드 데이터를 분류 통계로 재배치하고, 수의 각 매개 변수를 재배치하고, 다음 순환으로 이동합니다. 그러나 실 디스크 수준의 재측정을 할 때 문제가 발생합니다.[-2][“Volume”]의 거래량은 상반되지 않고, 큰 차이가 있는데, 통계적으로 구매 거래량과 판매 거래량은 모두 records보다 더 높습니다.[-2][“Volume”는 거래량이 많다는 것을 보여준다. 코드는 다음과 같습니다, 2 일 동안 저를 우회했습니다. 신들, 논리적인 문제가 있는지, 아니면 회귀 자체에 문제가 있는지 알려주십시오. 논리적인 문제가 있다면 자세히 알려주십시오. 감사합니다.

def GetRecords(self):
if self.LastBarTime == self.BarTime:
    trades = _C(exchange.GetTrades)
    if trades :
        for i in range (len(trades)):
            if trades[i] not in self.trades:
                 self.trades.append(trades[i])
if self.LastBarTime != self.BarTime: #新K线 
    if self.trades :
        for i in range (len(self.trades)):
            if self.trades[i]["Type"] == 0 : #买单
                self.trade_buy.append(self.trades[i])
            if self.trades[i]["Type"] == 1 : #卖单
                self.trade_sell.append(self.trades[i])
        if self.trade_buy:
            for i in range (len(self.trade_buy)):
                self.totlebuyamount += self.trade_buy[0-i]["Amount"]
        if self.trade_sell:
            for i in range (len(self.trade_sell)):
                self.totlesellamount += self.trade_sell[0-i]["Amount"]
        Log("总成交量",self.totlebuyamount+self.totolesellamoun,"买单成交量",self.totlebuyamount,"卖单成交量",self.totolesellamount) 
        self.trades = []
        self.trade_buy = []
        self.trade_sell = []
        self.totlebuyamount = 0
        self.totlesellamount  = 0