Example #1
0
# encoding: UTF-8
"""
导入MC导出的CSV历史数据到MongoDB中
"""

from vnpy.trader.app.ctaStrategy.ctaBase import MINUTE_DB_NAME, DAILY_DB_NAME
from vnpy.trader.app.ctaStrategy.ctaHistoryData import loadMcCsv

if __name__ == '__main__':

    # loadMcCsv('IF0000_1min.csv', MINUTE_DB_NAME, 'IF0000')
    loadMcCsv('rb0000_1day.csv', DAILY_DB_NAME, 'rb0000')
Example #2
0
        to_localtime(x[0] / 1000).split(' ')[1],
        'High':
        str(x[2]),
        'Low':
        str(x[3]),
        'Open':
        str(x[1]),
        'Close':
        str(x[4]),
        'TotalVolume':
        '{}.{}'.format(str(x[5]).split('.')[0],
                       str(x[5]).split('.')[1])
    } for x in klines])
    #print(df)

    if not os.path.exists(s_dir):
        os.makedirs(s_dir)

    df.to_csv(s_dir + filename.format(d.strftime('%Y%m%d')), index=False)
    loadMcCsv(s_dir + filename.format(d.strftime('%Y%m%d')), MINUTE_DB_NAME,
              symbol)

    # 比对官网数据,发现返回值前六项的含义以及对应顺序:时间戳,开,高,低,收,量
    # with open(data_folder.format(symbol, dt), 'w') as f:
    #     f.write('Timestamp,datetime,symbol,high,low,open,close,volume')
    #     f.write('\n')
    #     for element in klines:
    #         real_stamp = element[0]/1000        # 观察发现币安时间戳其实是1000倍的时间戳
    #         real_time = to_localtime(real_stamp)       # 转化为标准时间
    #         f.write(str(real_stamp) + ',' + str(real_time) + ',' + symbol + ',' + str(element[2]) + ',' + str(element[3]) + ',' + str(element[1]) + ',' + str(element[4]) + ',' + str(element[5]))
    #         f.write('\n')
Example #3
0
# encoding: UTF-8
"""
导入MC导出的CSV历史数据到MongoDB中
"""

import sys
sys.path.append('..')
sys.path.append('../..')

from vnpy.trader.app.ctaStrategy.ctaBase import MINUTE_DB_NAME
from vnpy.trader.app.ctaStrategy.ctaHistoryData import loadMcCsv

if __name__ == '__main__':
    loadMcCsv('IF0000_1min.csv', MINUTE_DB_NAME, 'IF0000')
    loadMcCsv('rb0000_1min.csv', MINUTE_DB_NAME, 'rb0000')
Example #4
0
# encoding: UTF-8

"""
导入MC导出的CSV历史数据到MongoDB中
"""

from vnpy.trader.app.ctaStrategy.ctaBase import MINUTE_DB_NAME
from vnpy.trader.app.ctaStrategy.ctaHistoryData import loadMcCsv


if __name__ == '__main__':
    loadMcCsv('HK.00700_1min.csv', MINUTE_DB_NAME, 'HK.00700')

Example #5
0
# encoding: UTF-8
"""
导入MC导出的CSV历史数据到MongoDB中
"""

from vnpy.trader.app.ctaStrategy.ctaBase import MINUTE_DB_NAME
from vnpy.trader.app.ctaStrategy.ctaHistoryData import loadMcCsv

if __name__ == '__main__':
    #loadMcCsv('IF0000_1min.csv', MINUTE_DB_NAME, 'IF0000')
    #loadMcCsv('rb0000_1min.csv', MINUTE_DB_NAME, 'rb0000')
    loadMcCsv('rb1901_180906_edit.csv', MINUTE_DB_NAME, 'rb1901')
Example #6
0
# encoding: UTF-8
"""
导入MC导出的CSV历史数据到MongoDB中
"""

from vnpy.trader.app.ctaStrategy.ctaBase import MINUTE_DB_NAME
from vnpy.trader.app.ctaStrategy.ctaHistoryData import loadMcCsv

if __name__ == '__main__':
    #loadMcCsv('IF0000_1min.csv', MINUTE_DB_NAME, 'IF0000')
    #loadMcCsv('rb0000_1min.csv', MINUTE_DB_NAME, 'rb0000')
    loadMcCsv('rb1905_1119.csv', MINUTE_DB_NAME, 'rb1905')
    loadMcCsv('ma1901_1119.csv', MINUTE_DB_NAME, 'MA901')
    loadMcCsv('ma1905_1119.csv', MINUTE_DB_NAME, 'MA905')
    loadMcCsv('sm1901_1119.csv', MINUTE_DB_NAME, 'SM901')
    loadMcCsv('sm1905_1119.csv', MINUTE_DB_NAME, 'SM905')
    loadMcCsv('sr1905_1119.csv', MINUTE_DB_NAME, 'SR905')
    loadMcCsv('ta1901_1119.csv', MINUTE_DB_NAME, 'TA901')
    loadMcCsv('ta1905_1119.csv', MINUTE_DB_NAME, 'TA905')
    loadMcCsv('i1901_1119.csv', MINUTE_DB_NAME, 'i1901')
    loadMcCsv('I1905_1119.csv', MINUTE_DB_NAME, 'i1905')
    loadMcCsv('j1901_1119.csv', MINUTE_DB_NAME, 'j1901')
    loadMcCsv('j1905_1119.csv', MINUTE_DB_NAME, 'j1905')
    loadMcCsv('jm1901_1119.csv', MINUTE_DB_NAME, 'jm1901')
    loadMcCsv('jm1905_1119.csv', MINUTE_DB_NAME, 'jm1905')
    loadMcCsv('l1901_1119.csv', MINUTE_DB_NAME, 'l1901')
    loadMcCsv('l1905_1119.csv', MINUTE_DB_NAME, 'l1905')
    loadMcCsv('p1901_1119.csv', MINUTE_DB_NAME, 'p1901')
    loadMcCsv('p1905_1119.csv', MINUTE_DB_NAME, 'p1905')
    loadMcCsv('pp1901_1119.csv', MINUTE_DB_NAME, 'pp1901')
    loadMcCsv('pp1905_1119.csv', MINUTE_DB_NAME, 'pp1905')
Example #7
0
# encoding: UTF-8
"""
导入MC导出的CSV历史数据到MongoDB中
"""

from vnpy.trader.app.ctaStrategy.ctaBase import MINUTE_DB_NAME
from vnpy.trader.app.ctaStrategy.ctaHistoryData import loadMcCsv

if __name__ == '__main__':
    loadMcCsv('rb1901.csv', MINUTE_DB_NAME, 'RB0000')
Example #8
0
# encoding: UTF-8

"""
导入MC导出的CSV历史数据到MongoDB中
"""

from vnpy.trader.app.ctaStrategy.ctaBase import MINUTE_DB_NAME
from vnpy.trader.app.ctaStrategy.ctaHistoryData import loadMcCsv


if __name__ == '__main__':
    loadMcCsv('IF0000_1min.csv', MINUTE_DB_NAME, 'IF0000')

Example #9
0
# encoding: UTF-8
"""
导入MC导出的CSV历史数据到MongoDB中
"""

from vnpy.trader.app.ctaStrategy.ctaBase import MINUTE_DB_NAME
from vnpy.trader.app.ctaStrategy.ctaHistoryData import loadMcCsv

if __name__ == '__main__':
    loadMcCsv('HK.00700_1min.csv', MINUTE_DB_NAME, 'HK.00700')