exchanges

package
v0.0.0-...-4f87207 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2017 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExchangeSell = "sell"
	ExchangeBuy  = "buy"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClosedSummaryReport

type ClosedSummaryReport struct {
	// contains filtered or unexported fields
}

func NewClosedSummaryReport

func NewClosedSummaryReport(rs []*Report) *ClosedSummaryReport

func (*ClosedSummaryReport) ProfitLoss

func (r *ClosedSummaryReport) ProfitLoss() float64

type Exchange

type Exchange struct {
	gorm.Model

	// from zenbot format
	// {exchange_slug}.{asset}-{currency}
	// poloniex.AMP-BTC
	Asset    string
	Currency string

	GlobalTradeID int64 `gorm:"unique"`
	TradeID       int64
	Date          time.Time
	Rate          float64
	Amount        float64
	Total         float64
	Fee           float64
	OrderNumber   int64
	Type          string
	Category      string
}

PoloniexAuthenticatedTradeHistory

func NewExchange

func NewExchange(asset, currency string, h poloniex.PoloniexAuthentictedTradeHistory) Exchange

func (*Exchange) CurrencyPair

func (r *Exchange) CurrencyPair() string

func (*Exchange) DateStr

func (r *Exchange) DateStr() string

func (*Exchange) FeeAmount

func (r *Exchange) FeeAmount() float64

func (*Exchange) MakeHistory

func (*Exchange) MyAmount

func (r *Exchange) MyAmount() float64

func (*Exchange) MyTotal

func (r *Exchange) MyTotal() float64

type Report

type Report struct {
	Asset    string
	Currency string
	Rows     []Exchange
	// contains filtered or unexported fields
}

func NewReport

func NewReport(asset, currency string, ticker poloniex.PoloniexTicker, rows []Exchange) (closed, opened *Report)

func NewReports

func NewReports(tickers *kanaelib.TickerCache, rows []Exchange) (closedList, openedList []*Report)

func (*Report) CurrentAsset

func (r *Report) CurrentAsset() float64

func (*Report) EarningRate

func (r *Report) EarningRate() float64

func (*Report) EquivalentCurrency

func (r *Report) EquivalentCurrency() float64

func (*Report) ProfitLoss

func (r *Report) ProfitLoss() float64

func (*Report) TotalAssetBuys

func (r *Report) TotalAssetBuys() float64

func (*Report) TotalAssetSells

func (r *Report) TotalAssetSells() float64

func (*Report) TotalCurrencyBuys

func (r *Report) TotalCurrencyBuys() float64

type Sync

type Sync struct {
	// contains filtered or unexported fields
}

func NewSync

func NewSync(db *gorm.DB, api *poloniex.Poloniex) *Sync

func (*Sync) GetLastTime

func (sync *Sync) GetLastTime() time.Time

func (*Sync) Sync

func (sync *Sync) Sync(currencyPair string, start, end time.Time) (int, error)

currencyPair example : "all", "BTC_DOGE"

func (*Sync) SyncAll

func (sync *Sync) SyncAll() (int, error)

func (*Sync) SyncRecent

func (sync *Sync) SyncRecent() (int, error)

type View

type View struct {
	// contains filtered or unexported fields
}

func NewView

func NewView(db *gorm.DB) *View

func (*View) All

func (v *View) All() []Exchange

func (*View) Get

func (q *View) Get(asset, currency string) []Exchange

func (*View) UsedAssets

func (v *View) UsedAssets(currency string) []string

Jump to

Keyboard shortcuts

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