Documentation
¶
Index ¶
- Constants
- Variables
- type Client
- func (p *Client) CancelByID(id string) (int, error)
- func (p *Client) Check()
- func (p *Client) ClosePositions() (*Order, error)
- func (p *Client) Connect()
- func (p *Client) ConnectForPrivate()
- func (p *Client) CulcForward()
- func (p *Client) GetOrders(prefix string, start, end time.Time) ([]Order, error)
- func (p *Client) GetOrdersInfo(prefix string, start, end time.Time) ([]OrdersInfo, error)
- func (p *Client) IgniteBasic()
- func (p *Client) Interactive()
- func (p *Client) LogicChecker()
- func (p *Client) OrderBySimple(isMarket bool, side int, price, size float64, timeInForce *string) (*Order, error)
- func (p *Client) OrderGroup()
- func (p *Client) SetError(isWait bool, err error)
- type Controller
- type Controllers
- type Executes
- type LogicByBasic
- type Logicer
- type Logics
- type Order
- type Orders
- func (p *Orders) Check(e []executions.Execution)
- func (p *Orders) CheckByPrivateWs(childorders []jsonrpc.WsResponceForChildEvent)
- func (p *Orders) GetOrderSize(side int, sizes []float64) (bool, float64)
- func (p *Orders) IsCancel(o *Order) bool
- func (p *Orders) Set(o Order)
- func (p *Orders) Size() (size float64)
- type OrdersInfo
Constants ¶
const ( EXCHANGE = "bitflyer" RECONNECTMINUTE = 12 DELAYTHRESHHOLD = 2000 * time.Millisecond // ORDER WAITEXECUTE = 1800 // second // LOGIC workers WORKERS = 10 WORKERMMPROFIT = 1 WORKERMMBASIC = 1 // CHECKRESOUCEPERIOD websocket executionsの集計(期間内最大変動などを取得) CHECKRESOUCEPERIOD = 3 // MMBASICCANCELORDER is basic market make orderの板乗り時間(±Delay, ±PingTime)でCHECKRESOUCEPERIOD*MMBASICCANCELORDER秒を基本とする MMBASICCANCELORDER = 3 )
const ( // AGGPERIOD Aggregation period AGGPERIOD = 15 // DBTABLEORDERS 注文(約定: IsDone) DBTABLEORDERS = "orders" // DBTABLEORDERSFORTEST 注文(約定: IsDone) DBTABLEORDERSFORTEST = "orders_test" // DBTABLEORDERSINFO 約定集計(約定率やbid/askの傾き、最大保持枚数) DBTABLEORDERSINFO = "orders_info" )
const (
DISCORDPREFIX = "."
)
Variables ¶
var (
BUYPRICE, SELLPRICE float64
)
var (
TANHTENSION = 0.01
)
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { DB *db.Client Discord *discordgo.Session // Event駆動用 Event chan interface{} C *v1.Client Controllers *Controllers Setting *config.Setting // API Limit Public *v1.Limit Private *v1.Limit // Executions E *Executes O *Orders // Logic 可否 Logics *Logics // Logic 発注開始 Logic chan Logicer Logger *logrus.Entry }
func (*Client) CancelByID ¶
CancelByID is cancel by orderID
func (*Client) ClosePositions ¶
func (*Client) ConnectForPrivate ¶
func (p *Client) ConnectForPrivate()
ConnectForPrivate check order status
func (*Client) GetOrdersInfo ¶
GetOrdersInfo aggrigate orders
func (*Client) Interactive ¶
func (p *Client) Interactive()
func (*Client) LogicChecker ¶
func (p *Client) LogicChecker()
LogicChecker is check for ignition, par sec.
type Controller ¶
Controller ロジックの稼働数量管理
func (*Controller) IsOK ¶
func (p *Controller) IsOK() bool
IsOK check worker limit, if ok subtracte count
type Controllers ¶
type Controllers struct { Profit *Controller Basic *Controller Special *Controller VPIN *Controller Swing *Controller }
Controllers is 各種ロジックの同時稼働数管理
type Executes ¶
type Executes struct { sync.RWMutex // BestAsk/Bid IsBuy bool Length int Price float64 LastPrice float64 BestAsk float64 BestBid float64 // 期間内高値安値 IsRise int High, Low float64 // 出来高 Volume float64 // n秒足乖離(加速度) Prices []float64 Volumes []float64 PricesPast []float64 VolumesPast []float64 Delay time.Duration DelayMean time.Duration }
Executes is 一般約定情報
func (*Executes) ChangePrice ¶
ChangePrice is changed price 1tick ws executions
func (*Executes) Set ¶
func (p *Executes) Set(e []executions.Execution)
Set is set executions to struct
type LogicByBasic ¶
type LogicByBasic struct {
Name string
}
func (*LogicByBasic) BackTest ¶
func (logic *LogicByBasic) BackTest(p *Client, side int, price, size float64) error
BackTest check execution, and set database
func (*LogicByBasic) Order ¶
func (logic *LogicByBasic) Order(p *Client)
Order do order and execution for MM Basic
type Order ¶
type Order struct { OrderID string Side string Price float64 Size float64 IsDone bool // 注文からAPI返り値までの時間 OnAccept time.Duration }
Order informations
type Orders ¶
type Orders struct { LastBuyOnAccept float64 LastSellOnAccept float64 Orders *sync.Map Cancels *sync.Map Positions *sync.Map Result chan string }
Orders is orders/positions struct
func (*Orders) Check ¶
func (p *Orders) Check(e []executions.Execution)
Check is check ws.Exec by orderID
func (*Orders) CheckByPrivateWs ¶
func (p *Orders) CheckByPrivateWs(childorders []jsonrpc.WsResponceForChildEvent)
CheckByPrivateWs get cancel and expire, delete order in orders and set cancels
func (*Orders) GetOrderSize ¶
GetOrderSize is new Size adjustor include go-bitflyer private positions
type OrdersInfo ¶
type OrdersInfo struct { Length int Rate float64 RateBid, RateAsk float64 Max float64 AvgBid, AvgAsk float64 VolumeBid, VolumeAsk float64 OrdersizeBid, OrdersizeAsk float64 ExecTime time.Duration CreatedAt time.Time }
func (*OrdersInfo) Columns ¶
func (p *OrdersInfo) Columns() string
Columns return string, header columns