-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbatch_rb.py
More file actions
31 lines (24 loc) · 748 Bytes
/
batch_rb.py
File metadata and controls
31 lines (24 loc) · 748 Bytes
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
'''
Created on Nov 22, 2017
@author: ethan
Python3 64bit pandas v0.20
'''
import multiprocessing
import os
import pandas as pd
from datetime import datetime
import sys
def psrun(symbol, contract, date):
os.system('python3 clean.py '+ symbol + ' ' + contract + ' ' + date)
if __name__ == '__main__':
p = multiprocessing.Pool(processes = 6)
symbol = sys.argv[1]
contract = sys.argv[2]
date_range = pd.Series(pd.date_range(start=datetime(2017,10,1), end=datetime(2017,11,30), freq='D')).dt.date
date_range = date_range.apply(lambda x: x.strftime('%Y%m%d'))
for date in date_range:
p.apply_async(psrun,(symbol, contract, date))
print('Start processing...')
p.close()
p.join()
print('Done...')