Skip to content

Commit

Permalink
- change : 去掉了对 shelve 的使用,同时不再依赖于 bsddb。此时没有bsddb的Python3,应该可以使用。
Browse files Browse the repository at this point in the history
  • Loading branch information
lamter committed Apr 27, 2017
1 parent 45d4301 commit 1e1ca13
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions vn.trader/vtEngine.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# encoding: UTF-8

import shelve
# import shelve
from collections import OrderedDict
from datetime import datetime

Expand Down Expand Up @@ -311,19 +311,21 @@ def getAllContracts(self):
#----------------------------------------------------------------------
def saveContracts(self):
"""保存所有合约对象到硬盘"""
f = shelve.open(self.contractFileName)
f['data'] = self.contractDict
f.close()
pass
# f = shelve.open(self.contractFileName)
# f['data'] = self.contractDict
# f.close()

#----------------------------------------------------------------------
def loadContracts(self):
"""从硬盘读取合约对象"""
f = shelve.open(self.contractFileName)
if 'data' in f:
d = f['data']
for key, value in d.items():
self.contractDict[key] = value
f.close()
pass
# f = shelve.open(self.contractFileName)
# if 'data' in f:
# d = f['data']
# for key, value in d.items():
# self.contractDict[key] = value
# f.close()

#----------------------------------------------------------------------
def updateOrder(self, event):
Expand Down

0 comments on commit 1e1ca13

Please sign in to comment.