Skip to content

Commit 3defd9c

Browse files
committed
Comply new transaction time format for joinquant
1 parent 4c1d010 commit 3defd9c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

strategyease_sdk/joinquant/transaction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def __init__(self, json):
1212

1313
def normalize(self):
1414
transaction = Transaction()
15-
transaction.completed_at = datetime.strptime('{} {}'.format(self.date, self.time), '%Y-%m-%d %H:%M')
15+
transaction.completed_at = datetime.strptime('{} {}'.format(self.date, (self.time + ':00')[:8]), '%Y-%m-%d %H:%M:%S')
1616
transaction.action = 'BUY' if self.transaction == u'买' else 'SELL'
1717
transaction.symbol = re.search(".*\\((\\d+)\\..*\\)", self.stock).group(1)
1818
transaction.type = 'LIMIT' if self.type == u'限价单' else 'MARKET'

tests/sample_data/transactionDetail.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
},
2424
{
2525
"date": "2017-06-01",
26-
"time": "14:55",
26+
"time": "14:55:00",
2727
"security": "股票",
2828
"stock": "万科A(000002.XSHE)",
2929
"transaction": "",

0 commit comments

Comments
 (0)