This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exchangeStrategies: | |
- on: binance_cross_margin | |
yourstrategy: | |
symbol: LINKUSDT | |
interval: 1m | |
param1: ... | |
param2: ... | |
param3: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sessions: | |
# cross margin connection for binance | |
binance_cross_margin: | |
exchange: binance | |
margin: true | |
# isolated margin connection for binance (LINKUSDT only) | |
binance_margin_linkusdt: | |
exchange: binance | |
margin: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
persistence: | |
redis: | |
host: 127.0.0.1 | |
port: 6379 | |
db: 0 | |
exchangeStrategies: | |
- on: binance | |
bollmaker: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ... { | |
bbgo.StrategySuspender | |
} | |
func (s *Strategy) Run() error { | |
s.StrategySuspender.OnResume(func() {. .... }) | |
s.StrategySuspender.OnSuspend(func() { ...... }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
❯ go generate ./example/api | |
DEBU[0000] args: ["/var/folders/cj/t7zd5tq50b588__zcp9bndwh0000gn/T/go-build2428829358/b001/exe/requestgen" "-type" "NoParamRequest" "-url" "/v1/bullet" "-method" "GET" "-debug"] | |
DEBU[0001] found APIClient field client -> github.com/c9s/requestgen.APIClient | |
DEBU[0001] add package import: fmt | |
DEBU[0001] add package import: net/url | |
DEBU[0001] add package import: encoding/json | |
DEBU[0001] add package import: regexp | |
DEBU[0001] add package import: net/url | |
DEBU[0001] add package import: context | |
DEBU[0001] importing github.com/c9s/requestgen/example/api from github.com/c9s/requestgen/example/api, same package object (pointer), no import template-function=qualifier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/src/github.com/c9s/requestgen/example/api on main !2 ··········································································································································· took 8s at 13:10:21 | |
❯ go generate | |
DEBU[0000] args: ["/var/folders/cj/t7zd5tq50b588__zcp9bndwh0000gn/T/go-build3294247184/b001/exe/requestgen" "-type" "NoParamRequest" "-url" "/v1/bullet" "-method" "GET" "-debug"] | |
DEBU[0000] found APIClient field client -> github.com/c9s/requestgen.APIClient | |
DEBU[0000] add package import: fmt | |
DEBU[0000] add package import: net/url | |
DEBU[0000] add package import: encoding/json | |
DEBU[0000] add package import: regexp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package api | |
func (p *PlaceOrderRequest) Do(ctx context.Context) (interface{}, error) { | |
// empty params for GET operation | |
var params interface{} | |
query, err := p.GetQueryParameters() | |
if err != nil { | |
return nil, err | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package requestgen | |
import ( | |
"context" | |
"net/http" | |
"net/url" | |
) | |
type AuthenticatedRequestBuilder interface { | |
// NewAuthenticatedRequest builds up the http request for authentication-required endpoints |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package api | |
import "github.com/c9s/requestgen" | |
//go:generate requestgen -type PlaceOrderRequest -method POST -url /v1/orders -responseType .Response | |
type PlaceOrderRequest struct { | |
client requestgen.AuthenticatedAPIClient | |
// A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters. | |
clientOrderID *string `param:"clientOid,required" defaultValuer:"uuid()"` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package api | |
import "github.com/c9s/requestgen" | |
//go:generate requestgen -type PlaceOrderRequest | |
type PlaceOrderRequest struct { | |
symbol string `param:"symbol,required"` | |
// "buy" or "sell" | |
side SideType `param:"side,required" validValues:"buy,sell"` |