zaif交易所交易bot框架
zaifbot的Python项目详细描述
chart_with_upwards_trend: | |
---|---|
algorithmic trading bot for zaif exchange |
zaifbot是一个运行在Zaif
Exchange上的pythonic算法交易库。
它是使用Python3.5.3开发的,并在Python3.4、3.5中进行了测试,
3.6.
功能
- 易于使用:zaifbot是一个为贸易初学者设计的库。 很简单。
- 支持处理的所有货币对Zaif Exchange
- SMA、EMA、Bollinger波段、RSI、ADX等技术指标
- 你不必准备市场数据。Zaifbot内部获取数据 zaif API
要开始使用zaifbot,请查看
tutorial
以及full
documentation.
注意:zaifbot是Tech Bureau, Inc.的非正式库,请自行承担使用风险。
安装
与pip一起安装
激活独立的python环境后,运行
$ pip install zaifbot
当前支持的平台包括:
- Linux 64位
- OSX 64位
- Windows 64位
注意:如果使用osx,我们假设
homebrew已安装。
设置
安装zaifbot后,运行
$ install_ta_lib
ta lib是技术分析指标的开源库
Zaifbot取决于。
此命令在操作系统中安装ta lib。
然后,
$ init_database
执行init_database命令时,
db/zaifbot.db是为sqlite创建的,模式被迁移。
您的交易记录将保存在此文件中。
快速启动
下面的代码使用zaifbot实现了一个简单的交易算法
fromzaifbot.tradeimportStrategyfromzaifbot.rulesimportEntry,Exitfromzaifbot.configimportset_keysfromzaifbot.trade.toolsimportlast_price# setting your Zaif API keyset_keys(key='your_key',secret='your_secret')# creating rule to buyclassBuyWhenCheap(Entry):defcan_entry(self):iflast_price(self._currency_pair.name)<25000:returnTruereturnFalse# creating rule to exitclassExitWhenPriceGoUp(Exit):defcan_exit(self,trade):# 'trade' has the entry informationcurrent_price=last_price(trade.currency_pair.name)ifcurrent_price>trade.entry_price+5000:returnTruereturnFalsemy_entry=BuyWhenCheap(currency_pair='btc_jpy',amount=0.01,action='bid')my_exit=ExitWhenPriceGoUp()# strategy is an unite of automated tradingmy_strategy=Strategy(entry_rule=my_entry,exit_rule=my_exit)my_strategy.start(sec_wait=1)
反馈
如果你有问题,或者发现一个bug,请随时打开一个问题。
贡献
欢迎任何形式的贡献。
请按照以下步骤投稿。
- 分叉并将此存储库克隆到您的计算机上
- 运行docker build -t zaifbot .创建开发环境
- 编辑源代码并向depelopbranch发出pull请求