-
Notifications
You must be signed in to change notification settings - Fork 0
/
analysis.py
39 lines (27 loc) · 849 Bytes
/
analysis.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import logging
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from futures import SHFE
LOGGING_FILE = 'dataviewer.log'
logging.basicConfig(\
filename = LOGGING_FILE,
filemode = 'w',
level = logging.INFO,
format = '[%(asctime)s] %(levelname)s %(message)s',
datefmt = '%m/%d/%Y %I:%M:%S %p',
)
logger = logging.getLogger(__name__)
DEFAULT_SEPERATOR = '------------------------------'
if __name__ == '__main__':
shfe = SHFE()
shfe.loadTable()
assert shfe.table.size > 0, 'DataFrame `shfe.table` should NOT be EMPTY!'
# Example:
# 'http://www.shfe.com.cn/data/dailydata/ck/20180102dailyTimePrice.dat'
date = datetime.date(2018, 1, 2)
rows = shfe.getData(date = date)
print(rows)