How to use the ctpwrapper.TraderApi.TraderApiWrapper function in ctpwrapper

To help you get started, we’ve selected a few ctpwrapper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nooperpudd / ctpwrapper / ctpwrapper / Trader.py View on Github external
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with ctpwrapper.  If not, see .

"""
import time

from ctpwrapper.TraderApi import TraderApiWrapper


class TraderApiPy(TraderApiWrapper):

    def Create(self, pszFlowPath=""):
        super(TraderApiPy, self).Create(pszFlowPath.encode())

    def Release(self):
        super(TraderApiPy, self).Release()

    def Init(self):
        super(TraderApiPy, self).Init()
        time.sleep(0.1)  # wait for c++ init

    def Join(self):
        return super(TraderApiPy, self).Join()

    def GetTradingDay(self):
        """