Skip to main content

This is a demo

Project description

MtySdk介绍

  • MtySdk目前是为麦田云际公司内部成员公司开发的局域网服务API.

快速入门

安装

pip install MtySdk==0.0.3

数据回测

#encoding: utf-8
from MtySdk import *

# 使用员工账号连接系统
api = MtyApi(auth=MtyAuth('account', 'password'))
# 按需求注册服务
math = api.query_math('kq_m_shfe_au','2018-01-02','2018-01-04')

# 注册成功情况下消费服务
while api.is_having():
    result = api.get_math(math)
    print(result)

# 关闭服务
api.close();

开仓平仓

#encoding: utf-8
from MtySdk import *

# 使用员工账号连接系统
api = MtyApi(auth=MtyAuth('account', 'password'))
# 1 . 开仓 按需求注册服务
math = api.query_math('CZCE.MA209C2850',None,None)
print(math)

# 注册成功情况下消费服务
while True:
    result = api.get_math(math)
    print(result)

    if result is None :
        api.close();
        break

    if result['datetime'] == '2018-01-02 09:10:00':
        # 开仓
        api.openoptions(math, result, 'BUY', result['close'], 1)

    if result['datetime'] == '2018-01-02 09:25:00':
        # 平仓
        api.closeposition(math, result, 'SELL', result['close'], 1)

# 展示收益曲线
showline(math['testplanid'])

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

MtySdk-0.0.4.tar.gz (3.1 kB view hashes)

Uploaded Source

Built Distribution

MtySdk-0.0.4-py3-none-any.whl (1.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page