数字货币BTC量化交易系统-实盘行情服务器,虚拟币自动炒币-火币API-币安交易所-量化交易-网格策略。趋势跟踪策略,最简源码,可在线回测,一键部署,可定制的比特币量化交易框架,3年实盘检验!

Overview

huobi_intf

提供火币网的实时行情服务器(支持火币网所有交易对的实时行情),自带API缓存,可用于实盘交易和模拟回测。 行情数据,是一切量化交易的基础,可以获取1min、60min、4hour、1day等数据。数据能进行缓存,可以在多个币种,多个时间段查询的时候,查询速度依然很快。 服务框架采用基于强大的异步网络库tornado

功能特点:

  • 为什么要用独立的行情服务器,直接调用火币的行情API不行吗?( https://github.com/mpquant/huobi_hq 我们另外一个项目,直接调用火币行情api的封装) 火币行情服务器比较慢,尤其在国内被墙,无法访问,尤其多个策略运行,一次需要获取多个币种数据做实时指标计算的时候,慢的让你怀疑人生,无法满足实盘要求,所以必须架设独立的行情服务器

  • 自带Redis接口缓存,重复的历史日线,4小时线等数据获取一次即被缓存,下次策略再取得时候直接返回,速度加速上百倍

  • 完美包装火币的行情API,行情服务对外只简洁到一个get_price()函数,可以实时获取火币所有交易对实时行情,包括按天,4小时,1小时,15分钟,5分钟,1分钟的实时行情

  • 历史行情支持从当前时间往前推3000条,和历史任意时间200条的数据 (需要历史任意时间3000以上条可以联系下面微信)

  • 在本行情服务器基础上开发有增强版的本地历史行情服务器内存数据版,用来做策略回测,调参等,可以达到半年数据1分钟跑完回测看结果 (感兴趣的可以联系下面微信)

  • 最简函数调用 get_price(security, start_date=None, end_date=None, count=None, frequency='1d', fields=['open','close', 'low', 'high']) 具体看下面例子,懂的自然能看懂

  • 行情服务器编程语言是python,采用高性能异步网络框架tornado做WebApi, 标准json返回,所有语言都能方便调用

  • 经过半年的运行,已经是非常稳定的版本,可以直接用在实盘生成环境

  • 针对高频交易,每秒都要更新价格那种,可以联系最下面微信,我们提供分布式多端密集更新方案,来满足秒级别行情的要求

  • 稳定,可靠,及时的行情服务器是高波动率数字货币量化交易的基础实施,我们全部开源出来,希望能帮助到大家

系统架构图:

web

服务器启动说明

运行文件huobi_app.py启动服务,服务启动后就可以用程序调用所有的接口

python3 huobi_app.py

   (可选运行参数  --port=8005  )

启动成功后,在浏览器里输入http://127.0.0.1:8005/info,如果能出现下边的画面,说明启动成功了
info

需安装第三方库 (python >= 3.6 )

  • requests
  • pandas
  • tornado
  • websocket-client

安装时执行命令:pip install -r requirements.txt

接口说明

  • get_price接口得到火币的币的数据,返回dataframe的格式

  • 为了支持多交易所(币安,okex等),我们规范定义了几个核心数据格式

    • 交易对统一用 btc.usdt , eth.usdt , eth.btc 这样的中间加.分割的格式
    • 时间周期统一用 1d: 一天 , 4h: 四小时 , 60m: 60分 , 15m:15分 , 5m:5分 , 1m:1分 这样的格式
#1分钟的数据获取
df = get_price('btc.usdt', end_date='2021-04-25 18:56:23', count=1, frequency='1m')

#日线的数据获取
df = get_price('btc.usdt', end_date='2021-04-25 18:56:23', count=10, frequency='1d')

#4小时的数据获取
df = get_price('btc.usdt', end_date='2021-04-25 18:56:23', count=10, frequency='4h')

#1小时的数据获取
df = get_price('btc.usdt', end_date='2021-04-25 18:56:23', count=10, frequency='60m')

btc的1分钟线

btc1min

btc日线

btc日线

实盘策略收益图

下图是利用利用这个行情框架,跑的策略收益图 (山寨币趋势轮动策略) rate

3、intf_test.py里有调用这个接口的例子


巴特量化

  • 数字货币 股市量化工具 行情系统软件开发
  • BTC虚拟货币量化交易策略开发 自动化交易策略运行

加入群聊

Thread-safe Python RabbitMQ Client & Management library

AMQPStorm Thread-safe Python RabbitMQ Client & Management library. Introduction AMQPStorm is a library designed to be consistent, stable and thread-sa

Erik Olof Gunnar Andersson 167 Nov 20, 2022
Satoshi is a discord bot template in python using discord.py that allow you to track some live crypto prices with your own discord bot.

Satoshi ~ DiscordCryptoBot Satoshi is a simple python discord bot using discord.py that allow you to track your favorites cryptos prices with your own

Théo 2 Sep 15, 2022
A Telegram Video Watermark Adder Bot

Watermark-Bot A Telegram Video Watermark Adder Bot by @VideosWaterMarkRobot Features: Save Custom Watermark Image. Auto Resize Watermark According to

5 Jun 17, 2022
An open source development framework to help you build data workflows and modern data architecture on AWS.

AWS DataOps Development Kit (DDK) The AWS DataOps Development Kit is an open source development framework for customers that build data workflows and

Amazon Web Services - Labs 111 Dec 23, 2022
Marketplace for self published books

Nile API API for the imaginary Nile marketplace for self published books. This is a project created to try out FastAPI as the post promising ASGI serv

Matt de Young 1 Jan 31, 2022
Bot made with Microsoft Azure' cloud service

IttenWearBot Autori: Antonio Zizzari Simone Giglio IttenWearBot è un bot intelligente dotato di sofisticate tecniche di machile learning che aiuta gli

Antonio Zizzari 1 Jan 24, 2022
Python package for Calendly API v2

PyCalendly Python package to use Calendly API-v2. Installation Install with pip $ pip install PyCalendly Usage Getting Started See Getting Started wi

Lakshmanan Meiyappan 20 Dec 05, 2022
A simple script that loads and hot-reloads cogs when you save any changes

DiscordBot-HotReload A simple script that loads and hot-reloads cogs when you save any changes Usage @bot.event async def on_ready(): from HotRelo

2 Jan 14, 2022
Stock market bot that will be used to learn about API calls and database connections.

Stock market bot that will be used to learn about API calls and database connections.

1 Dec 24, 2021
A Telegram bot for Download songs in mp3 format from YouTube and Extract lyrics from Genius.com ❤️

MeudsaMusic A Telegram bot for Download songs in mp3 format from YouTube and Extract lyrics from Genius.com ❤️ Commands Reach @MedusaMusic on Telegram

Bibee 14 Oct 06, 2022
A simple discord bot that generates facts!

fact-bot A simple discord bot that generates facts! How to make a bot Go to https://discord.com/developers/applications Then click on 'New Application

1 Jan 05, 2022
Python lib for Embedly

embedly-python Python library for interacting with Embedly's API. To get started sign up for a key at embed.ly/signup. Install Install with Pip (recom

Embedly 80 Oct 05, 2022
Pluggable Telethon - Telegram UserBot

A stable pluggable Telegram userbot, based on Telethon.

Team Ultroid 2.3k Dec 30, 2022
Migration Manager (MM) is a very small utility that can list source servers in a target account and apply mass launch template modifications.

Migration Manager Migration Manager (MM) is a very small utility that can list source servers in a target account and apply mass launch template modif

Cody 2 Nov 04, 2021
A group management bot written in python3 using the python-telegram-bot library.

Chika Fujiwara A modular telegram Python bot running on python3 with an sqlalchemy database. Originally a Marie fork, Chika was created for personal u

Wahyusaputra 3 Feb 12, 2022
♻️ API to run evaluations of the FAIR principles (Findable, Accessible, Interoperable, Reusable) on online resources

♻️ FAIR enough 🎯 An OpenAPI where anyone can run evaluations to assess how compliant to the FAIR principles is a resource, given the resource identif

Maastricht University IDS 4 Oct 20, 2022
A file-based quote bot written in Python

Let's Write a Python Quote Bot! This repository will get you started with building a quote bot in Python. It's meant to be used along with the Learnin

0 Jan 20, 2022
HackZ-Token-Grabber-V2 - HackZ Token Grabber V2

HackZ-Token-Grabber-V2 was made by Love ❌ code ✅ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ 🌟

! ™NightMare 2 Mar 01, 2022
A simple Python API wrapper for Cloudflare Stream's API.

python-cloudflare-stream A basic Python API wrapper for working with Cloudflare Stream. Arbington.com started off using Cloudflare Stream. We used the

Arbington 3 Sep 08, 2022
A BOT TO FIND ID OF A STICKER.

sticker id A BOT TO FIND ID OF A STICKER. THIS REPOSITORY HAVE TWO BRANCHES FOR DEPLOY WITH COMMAND & WITHOUT COMMAND. Mandatory variables API_ID - Ge

Ashik Muhammed 3 Dec 29, 2022