Beispiel #1
0
    def SubscribeMdSnapshot(self, ukey):
        self.SyncQuoteSpi.mCondition.acquire()
        ret_code = self.mQuoteApi.SubscribeMdSnapshot(ukey)
        if ret_code != 0:
            self.SyncQuoteSpi.mCondition.release()
            return (None, ret_code, Error.GetErrorInfo(ret_code))
        self.SyncQuoteSpi.mCondition.wait()

        return (self.SyncQuoteSpi.mResult, self.SyncQuoteSpi.mErrorCode,
                self.SyncQuoteSpi.mErrorInfo)
Beispiel #2
0
    def ReqCancelOrder(self, cancel_order):
        self.SyncTradeSpi.mCondition.acquire()
        ret_code = self.mTradeApi.ReqCancelOrder(cancel_order)
        if ret_code != 0:
            self.SyncTradeSpi.mCondition.release()
            return (None, ret_code, Error.GetErrorInfo(ret_code))

        self.SyncTradeSpi.mCondition.wait()

        return (self.SyncTradeSpi.mResult, self.SyncTradeSpi.mErrorCode,
                self.SyncTradeSpi.mErrorInfo)
Beispiel #3
0
    def ReqUserLogout(self):
        self.SyncTradeSpi.mCondition.acquire()
        ret_code = self.mTradeApi.ReqUserLogout()
        if ret_code != 0:
            self.SyncTradeSpi.mCondition.release()
            return (None, ret_code, Error.GetErrorInfo(ret_code))

        self.SyncTradeSpi.mCondition.wait()

        return (self.SyncTradeSpi.mResult, self.SyncTradeSpi.mErrorCode,
                self.SyncTradeSpi.mErrorInfo)
Beispiel #4
0
    def ReqUserLogin(self, fgs_user):
        self.SyncQuoteSpi.mCondition.acquire()
        ret_code = self.mQuoteApi.ReqUserLogin(fgs_user)
        if ret_code != 0:
            self.SyncQuoteSpi.mCondition.release()
            return (None, ret_code, Error.GetErrorInfo(ret_code))

        self.SyncQuoteSpi.mCondition.wait()

        return (self.SyncQuoteSpi.mResult, self.SyncQuoteSpi.mErrorCode,
                self.SyncQuoteSpi.mErrorInfo)
Beispiel #5
0
    def ReqQueryUkeyInfo(self, ukey):
        self.SyncTradeSpi.mCondition.acquire()
        ret_code = self.mTradeApi.ReqQueryUkeyInfo(ukey, self.mRequestId)
        if ret_code != 0:
            self.SyncTradeSpi.mCondition.release()
            return (None, ret_code, Error.GetErrorInfo(ret_code))

        self.SyncTradeSpi.mCondition.wait()
        self.mRequestId = self.mRequestId + 1

        return (self.SyncTradeSpi.mResult, self.SyncTradeSpi.mErrorCode,
                self.SyncTradeSpi.mErrorInfo)
Beispiel #6
0
    def ReqQueryMdKLineDayBackward(self, ukey_array, time_end, n):
        self.SyncQuoteSpi.mCondition.acquire()
        ret_code = self.mQuoteApi.ReqQueryMdKLineDayBackward(
            ukey_array, time_end, n, self.mRequestId)
        if ret_code != 0:
            self.SyncQuoteSpi.mCondition.release()
            return (None, ret_code, Error.GetErrorInfo(ret_code))

        self.SyncQuoteSpi.mCondition.wait()
        self.mRequestId = self.mRequestId + 1

        return (self.SyncQuoteSpi.mResult, self.SyncQuoteSpi.mErrorCode,
                self.SyncQuoteSpi.mErrorInfo)
Beispiel #7
0
    def ReqQueryMdTransaction(self, ukey_array, time_start, time_end):
        self.SyncQuoteSpi.mCondition.acquire()
        ret_code = self.mQuoteApi.ReqQueryMdTransaction(
            ukey_array, time_start, time_end, self.mRequestId)
        if ret_code != 0:
            self.SyncQuoteSpi.mCondition.release()
            return (None, ret_code, Error.GetErrorInfo(ret_code))

        self.SyncQuoteSpi.mCondition.wait()
        self.mRequestId = self.mRequestId + 1

        return (self.SyncQuoteSpi.mResult, self.SyncQuoteSpi.mErrorCode,
                self.SyncQuoteSpi.mErrorInfo)
Beispiel #8
0
    def ReqQueryDividendByXdDate(self, ukey, date_start, date_end):
        self.SyncQuoteSpi.mCondition.acquire()
        ret_code = self.mQuoteApi.ReqQueryDividendByXdDate(
            ukey, date_start, date_end, self.mRequestId)
        if ret_code != 0:
            self.SyncQuoteSpi.mCondition.release()
            return (None, ret_code, Error.GetErrorInfo(ret_code))

        self.SyncQuoteSpi.mCondition.wait()
        self.mRequestId = self.mRequestId + 1

        return (self.SyncQuoteSpi.mResult, self.SyncQuoteSpi.mErrorCode,
                self.SyncQuoteSpi.mErrorInfo)
Beispiel #9
0
    def ReqQueryETFComponentList(self, component_id):
        self.SyncQuoteSpi.mCondition.acquire()
        ret_code = self.mQuoteApi.ReqQueryETFComponentList(
            component_id, self.mRequestId)
        if ret_code != 0:
            self.SyncQuoteSpi.mCondition.release()
            return (None, ret_code, Error.GetErrorInfo(ret_code))

        self.SyncQuoteSpi.mCondition.wait()
        self.mRequestId = self.mRequestId + 1

        return (self.SyncQuoteSpi.mResult, self.SyncQuoteSpi.mErrorCode,
                self.SyncQuoteSpi.mErrorInfo)
Beispiel #10
0
    def ReqQueryFuturesContractProById(self, contract_id):
        self.SyncQuoteSpi.mCondition.acquire()
        ret_code = self.mQuoteApi.ReqQueryFuturesContractProById(
            contract_id, self.mRequestId)
        if ret_code != 0:
            self.SyncQuoteSpi.mCondition.release()
            return (None, ret_code, Error.GetErrorInfo(ret_code))

        self.SyncQuoteSpi.mCondition.wait()
        self.mRequestId = self.mRequestId + 1

        return (self.SyncQuoteSpi.mResult, self.SyncQuoteSpi.mErrorCode,
                self.SyncQuoteSpi.mErrorInfo)
Beispiel #11
0
    def ReqQuerySecumasterByType(self, market_id, variety_id, date):
        self.SyncQuoteSpi.mCondition.acquire()
        ret_code = self.mQuoteApi.ReqQuerySecumasterByType(
            market_id, variety_id, date, self.mRequestId)
        if ret_code != 0:
            self.SyncQuoteSpi.mCondition.release()
            return (None, ret_code, Error.GetErrorInfo(ret_code))

        self.SyncQuoteSpi.mCondition.wait()
        self.mRequestId = self.mRequestId + 1

        return (self.SyncQuoteSpi.mResult, self.SyncQuoteSpi.mErrorCode,
                self.SyncQuoteSpi.mErrorInfo)
Beispiel #12
0
    def ReqQueryUkeyInfoByCode(self, market_id, market_code):
        self.SyncQuoteSpi.mCondition.acquire()
        ret_code = self.mQuoteApi.ReqQueryUkeyInfoByCode(
            market_id, market_code, self.mRequestId)
        if ret_code != 0:
            self.SyncQuoteSpi.mCondition.release()
            return (None, ret_code, Error.GetErrorInfo(ret_code))

        self.SyncQuoteSpi.mCondition.wait()
        self.mRequestId = self.mRequestId + 1

        return (self.SyncQuoteSpi.mResult, self.SyncQuoteSpi.mErrorCode,
                self.SyncQuoteSpi.mErrorInfo)