Coder Social home page Coder Social logo

sudarsansridharan16 / goalgo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from f0cii/goalgo

0.0 1.0 0.0 407 KB

A real-time quantitative trading platform in Golang. 基于Go的量化交易平台

Home Page: https://www.faibot.com

License: MIT License

Go 99.87% Batchfile 0.13%

goalgo's Introduction

goalgo

A real-time quantitative trading platform in Golang.

这是一个严肃的基于 Go 的量化系统,目前正在内部使用。

目前支持基于以下两个库编写策略

GoEx https://github.com/nntaoli-project/GoEx

bitmexwrap https://github.com/sumorf/bitmexwrap

其中 bitmexwrap 提供了对 BitMEX 交易所的支持,内部集成了 Rest 和 WebSocket 接口

欢迎交流,欲使用此系统,请自行登录以下官网注册账号:

https://www.faibot.com

如有问题,请联系 QQ: 529808348

1.简单的基于 GoEx 策略脚本:

package main

import (
	"time"

	"github.com/nntaoli-project/GoEx"
	"github.com/sumorf/goalgo"
	"github.com/sumorf/goalgo/algo"
	"github.com/sumorf/goalgo/log"
)

// SimpleGoExStrategy 简单的GoEx策略
type SimpleGoExStrategy struct {
	algo.GoExStrategy
}

// Init 策略初始化方法,必须实现
func (s *SimpleGoExStrategy) Init() error {
	log.Info("Init")
	return nil
}

// Run 策略主逻辑,必须实现
func (s *SimpleGoExStrategy) Run() error {
	log.Info("Run")
	for s.IsRunning() {
		time.Sleep(5 * time.Second)
		// 获取交易所 Ticker 数据
		ticker, err := s.Exchange.GetTicker(goex.BTC_USDT)
		if err != nil {
			log.Errorf("%v", err)
			continue
		}
		log.Infof("Ticker %#v", ticker)
	}
	return nil
}

func main() {
	s := &SimpleGoExStrategy{}
	goalgo.Serve(s)
}

2.简单的基于 bitmexwrap(BitMEX 期货市场)策略脚本:

package main

import (
	"time"

	"github.com/sumorf/goalgo"
	"github.com/sumorf/goalgo/algo"
	"github.com/sumorf/goalgo/log"
)

// BitMEXDemoStrategy 示例策略(BitMEX)
type BitMEXDemoStrategy struct {
	algo.BitMEXStrategy
}

// Init 策略初始化方法,必须实现
func (s *BitMEXDemoStrategy) Init() error {
	log.Info("Init")
	balance, err := s.Exchange.Balance()
	if err != nil {
		log.Errorf("Balance error: %v", err)
		return err
	}
	log.Infof("balance: %v", balance)

	return nil
}

// Run 策略主逻辑,必须实现
func (s *BitMEXDemoStrategy) Run() error {
	log.Info("Run")
	for s.IsRunning() {
		time.Sleep(3 * time.Second)
		ticker, err := s.Exchange.Ticker()
		if err != nil {
			log.Errorf("%v", err)
			continue
		}
		log.Infof("ticker: %v", ticker)
	}
	return nil
}

func main() {
	s := &BitMEXDemoStrategy{}
	goalgo.Serve(s)
}

Thanks

This project uses the following external projects or products

  1. [RabbitMQ] https://www.rabbitmq.com/
  2. [PostgreSQL] https://www.postgresql.org/
  3. [ClickHouse] https://clickhouse.yandex/
  4. [Docker] https://www.docker.com/
  5. [GoEx] https://github.com/nntaoli-project/GoEx
  6. [coinex] https://github.com/SuperGod/coinex
  7. [porthos-go] https://github.com/porthos-rpc/porthos-go
  8. [go-plugin] https://github.com/hashicorp/go-plugin
  9. [gin] https://github.com/gin-gonic/gin
  10. [vuejs] https://vuejs.org/
  11. ...

捐赠

BTC:17XauetDWtwAZKHRyEw3DpYcRqzhKZzPHq

ETH:0x5e065711852fda9b75c4e490b1e35eea89b9aaa5

XRP:rshdB4kyxXkuPCtCgZw8DrcuSo7jEWfqck

goalgo's People

Contributors

f0cii avatar

Watchers

James Cloos 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.