Coder Social home page Coder Social logo

pybtc's Introduction

PyBTC: 一个加密货币自动交易系统

架构

在原有基础上更新版本ing Architecture 做成事件驱动版本
使用RabbitMQ传送事件
SQLite存储行情信息
MongoDB存储交易相关信息

功能

可以实现自定义币种、价格、数量的左侧交易或右侧交易
设定买入、卖出价格,自动循环交易
实现了网站 Python 版的 API, 可以自己开发交易策略
exe暂不支持 coinut
目前只能在 coinut 进行交易(strategy_ut.py)
在dist文件夹中双击 strategy.exe 即可运行,支持 Win7-Win10 32bit & 64bit
strategy.exe SHA256:
bd954b185be34a2aca3c31aa988ae3e8100403f072eacfd817a55dca21d91f02
w9xpopen.exe SHA256:
243c34e56805f87f0254d59826fbab1d062da19308644046a3a92997d86d0bdb
使用 py2exe 打包程序

系统需求

Mac、Linux、Win 都可运行
Win需要安装: Python 2.7

运行

btctrade.com申请“获取API认证的公钥和私钥”
coinut.com申请“REST API Key”
在命令行中运行
$python strategy.py
首次运行需要输入申请的公钥和私钥,所有的输入使用空格分隔

交易参数

btctrade
{left, right} {btc, eth, ltc, doge, ybc} {amount} {price} {price}

coinut
{left, right} {BTCUSDT, ETHUSDT, LTCUSDT} {amount_ratio} {price} {price}

例如

  1. 采用左侧交易(left),购买比特币(btc),数量比例(0.7),买入价(19500),卖出价(21000)
    $ python strategy.py
    Ctrl+C to quit!
    side coin amount_ratio buy_price sell_price: left btc 0.7 19500 21000
    $ python strategy.py left btc 0.7 19500 21000

  2. 采用左侧交易(left),购买比特币(btc),数量比例(0.7),浮动比例(0.01),止损比例(0.1)
    $ python 02_strategy.py left btc 0.7 0.01 0.1

  3. 自己调用交易函数如下:

import trade

print trade.get_last_price('btc')
#打印当前比特币的价格

buy_id = trade.trusted_buy('btc', '1', '19500')
#以19500的价格购买一个比特币,buy_id 为单号

sell_id = trade.trusted_sell('btc', '1', '37500')
#以37500的价格出售一个比特币,sell_id 为单号

演进计划

使用神经网络预测价格走势,目前在测试 RNN 代码
集成回测,模拟交易,交易

pybtc's People

Contributors

greatshi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.