Skip to content

Commit

Permalink
修复Mongodb_reader重复创建多个mongodb连接的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Chandlercjy committed Aug 10, 2018
1 parent be763c2 commit 120f446
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
5 changes: 5 additions & 0 deletions CHANGE_LOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Onepy

##### 2018.08.10

* Version:2.02
* 修复 Mongodb_reader 重复创建多个 mongodb 连接的 bug。

##### 2018.05.09

* Version:2.01
Expand Down
9 changes: 3 additions & 6 deletions OnePy/builtin_module/data_readers/mongodb_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,15 @@
class MongodbReader(DataReaderBase):
host = 'localhost'
port = 27017
client = pymongo.MongoClient(host=host, port=port, connect=False)

def __init__(self, database, collection, ticker, fromdate=None, todate=None, host=None, port=None):
def __init__(self, database, collection, ticker, fromdate=None, todate=None):
super().__init__(ticker, fromdate, todate)
self.host = host if host else self.host
self.port = port if port else self.port

self.database = database
self.collection = collection

def set_collection(self):
client = pymongo.MongoClient(host=self.host, port=self.port)
db = client[self.database]
db = self.client[self.database]
Collection = db[self.collection]

return Collection
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Onepy 2.1
# Onepy 2.2

Onepy is an event-driven algorithmic trading Python library.

Expand Down Expand Up @@ -133,7 +133,7 @@ print(go.output.trade_log())
#### Recorder 日志方面:

* 计算保证金, 仓位, 浮动利润, 已平仓利润, 总资金, 剩余现金, 收益率, 市值, 全部
   时间序列化 ✓
    时间序列化 ✓
* 输出交易记录, 包括出场时间, 入场时间, 盈亏点数, 盈亏利润等 ✓

#### 延展性方面:
Expand All @@ -142,7 +142,7 @@ print(go.output.trade_log())
* 自定义扩展事件源 ✓
* 自定义数据源, 返回迭代器给 OnePy 即可 ✓
* 自定义策略模块 ✓
*   自定义技术指标模块 ✓
* 自定义技术指标模块 ✓
* 自定义风控模块 ✓
* 自定义经纪商模块 ✓
* 自定义日志记录模块 ✓
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def run(self):

setup(
name="Onepy_trader",
version="2.01",
version="2.02",
author="Chandler_Chan",
author_email="[email protected]",
license="MIT",
Expand Down

0 comments on commit 120f446

Please sign in to comment.