models

package
v0.0.0-...-82d0e4a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2022 License: GPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppDB *sql.DB
View Source
var GormDB *gorm.DB

Functions

func CalculateMinuteToExpire

func CalculateMinuteToExpire(strategy int) int

func DeleteStrangeBuyOrderRecords

func DeleteStrangeBuyOrderRecords() int

func FilledCheck

func FilledCheck(productCode string) ([]string, error)

func GetResults

func GetResults() (string, error)

過去3日分の利益を取得する関数

func NewMysqlBase

func NewMysqlBase()

func ShouldPlaceBuyOrder

func ShouldPlaceBuyOrder(max_buy_orders, max_sell_orders int) (bool, error)
  • 注文前の判断メソッド
  • 買り注文の前に呼ばれ、 1. 未約定の買い注文数 < 最大買い注文数 2. 未約定の売り注文数 < 最大売り注文数 を両方満たす場合にtrueを返却。

func SyncBuyOrders

func SyncBuyOrders(events *[]OrderEvent)

func UpdateCancelledBuyOrder

func UpdateCancelledBuyOrder(order_id string) error

func UpdateFilledOrder

func UpdateFilledOrder(order_id string) error

func UpdateFilledOrderWithBuyOrder

func UpdateFilledOrderWithBuyOrder(order_id string) error

Types

type BuyOrder

type BuyOrder struct {
	ID          uint    `gorm:"primary_key"`
	OrderID     string  `json:"order_id"`
	ProductCode string  `json:"product_code"`
	Side        string  `json:"side"`
	Price       float64 `json:"price"`
	Size        float64 `json:"size"`
	Exchange    string  `json:"exchange"`
	Filled      int     `json:"filled"`
	Timestamp   string  `json:"timestamp"`
	Updatetime  string  `json:"updatetime"`
}

TODO structを整理すること TODO timestampはstring以外の型にすること

func GetCancelledBuyOrders

func GetCancelledBuyOrders() ([]BuyOrder, error)

type BuyOrderInfo

type BuyOrderInfo struct {
	OrderID     string  `json:"order_id"`
	Price       float64 `json:"price"`
	ProductCode string  `json:"product_code"`
	Size        float64 `json:"size"`
	Exchange    string  `json:"exchange"`
	Strategy    float64 `json:"strategy"`
}

func CheckFilledBuyOrders

func CheckFilledBuyOrders() []BuyOrderInfo

func (*BuyOrderInfo) CalculateSellOrderPrice

func (buyOrderInfo *BuyOrderInfo) CalculateSellOrderPrice() float64

type OrderEvent

type OrderEvent struct {
	OrderID     string    `json:"order_id"`
	Time        time.Time `json:"time"`
	ProductCode string    `json:"product_code"`
	Side        string    `json:"side"`
	Price       float64   `json:"price"`
	Size        float64   `json:"size"`
	Exchange    string    `json:"exchange"`
	Filled      int       `json:"filled"`
	Strategy    int       `json:"strategy"`
}

func (*OrderEvent) BuyOrder

func (e *OrderEvent) BuyOrder() error

func (*OrderEvent) SellOrder

func (e *OrderEvent) SellOrder(pid string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL