Version: v0.0.0-...-54de7ac Latest Latest

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

Go to latest
Published: Dec 22, 2017 License: MIT Imports: 2 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Campaign

type Campaign struct {
	ID                   int                    `storm:"id,increment" json:"id"`
	Provider             string                 `storm:"index" json:"provider"`
	ProviderRef          string                 `json:"provider_ref"`
	ProductID            string                 `storm:"index" json:"product_id"`
	Volume               float64                `json:"volume"`
	BuyLimit             float64                `json:"buy_limit"`
	SellLimit            float64                `json:"sell_limit"`
	SellLimitUnit        string                 `json:"sell_limit_unit"`
	CreatedAt            std.DateTime           `json:"created_at"`
	UpdatedAt            std.DateTime           `json:"updated_at"`
	BuyOrder             *Order                 `json:"buy_order"`
	SellOrder            *Order                 `json:"sell_order"`
	Orders               []*Order               `json:"orders"`
	State                CampaignState          `storm:"index" json:"state"`
	SellAlgorithm        string                 `json:"sell_algorithm"`
	SellAlgorithmOptions map[string]interface{} `json:"sell_algorithm_options"`
	BuyAlgorithm         string                 `json:"buy_algorithm"`
	BuyAlgorithmOptions  map[string]interface{} `json:"buy_algorithm_options"`

Campaign struct

func (*Campaign) AddOrder

func (c *Campaign) AddOrder(order *Order)

AddOrder to Campaign

func (*Campaign) IsBuying

func (c *Campaign) IsBuying() bool

IsBuying returns true if campaign is state buying

func (*Campaign) IsSelling

func (c *Campaign) IsSelling() bool

IsSelling returns true if campaign is state selling

func (Campaign) IsState

func (c Campaign) IsState(state CampaignState) bool

IsState check if this state is eq to state param

type CampaignState

type CampaignState string

CampaignState type

const (
	CampaignStateSell    CampaignState = "sell"
	CampaignStateSelling CampaignState = "selling"
	CampaignStateBuy     CampaignState = "buy"
	CampaignStateBuying  CampaignState = "buying"

CampaignState enum

type Order

type Order struct {
	Provider  string             `json:"provider"`
	ID        int                `storm:"id,increment" json:"id"`
	TradeID   string             `json:"trade_id"`
	Side      exchanges.SideType `json:"side"`
	Size      float64            `json:"size"`
	ProductID string             `json:"product_id"`
	Price     float64            `json:"price"`
	CreatedAt std.DateTime       `json:"created_at"`
	UpdatedAt std.DateTime       `json:"updated_at"`
	DeletedAt std.DateTime       `json:"deleted_at"`

Order struct

func (Order) GetBuyingMarketPrice

func (o Order) GetBuyingMarketPrice() float64

GetBuyingMarketPrice func

func (Order) GetCurrentPrice

func (o Order) GetCurrentPrice(marketPrice float64) float64

GetCurrentPrice from market price

func (Order) GetMarginInCurrency

func (o Order) GetMarginInCurrency(marketPrice float64) float64

GetMarginInCurrency from market price

func (Order) GetMarginInPercent

func (o Order) GetMarginInPercent(marketPrice float64) float64

GetMarginInPercent from market price

type User

type User struct {
	ID        int          `storm:"id" json:"id"`
	Email     string       `storm:"email" json:"email"`
	FirstName std.String   `storm:"firstname" json:"firstname,omitempty"`
	LastName  std.String   `storm:"lastname" json:"lastname,omitempty"`
	NickName  string       `storm:"nickname" json:"nickname"`
	UserName  string       `storm:"username" json:"username"`
	Password  string       `storm:"password" json:"-"`
	Salt      string       `storm:"salt" json:"salt"`
	IsEnabled bool         `storm:"enabled" json:"enabled"`
	IsExpired bool         `storm:"expired" json:"expired"`
	IsLocked  bool         `storm:"locked" json:"locked"`
	Timezone  std.String   `storm:"timezone" json:"timezone,omitempty"`
	Locale    std.String   `storm:"locale" json:"locale,omitempty"`
	CreatedAt std.DateTime `storm:"created_at" json:"created_at"`
	UpdatedAt std.DateTime `storm:"updated_at" json:"updated_at"`
	DeletedAt std.DateTime `storm:"deleted_at" json:"deleted_at"`

User struct

Jump to

Keyboard shortcuts

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