common

package
v0.0.0-...-7fd84a6 Latest Latest
Warning

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

Go to latest
Published: May 24, 2018 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APPNAME                = "tradebot"
	APPVERSION             = "0.0.1"
	TIME_FORMAT            = time.RFC3339
	TIME_DISPLAY_FORMAT    = "01-02-2006 15:04:05 MST"
	BUFFERED_CHANNEL_SIZE  = 256
	WEBSOCKET_KEEPALIVE    = 10 * time.Second
	HTTP_CLIENT_TIMEOUT    = 10 * time.Second
	CANDLESTICK_MIN_LOAD   = 250
	INDICATOR_PLUGIN_TYPE  = "indicator"
	STRATEGY_PLUGIN_TYPE   = "strategy"
	EXCHANGE_PLUGIN_TYPE   = "exchange"
	WALLET_PLUGIN_TYPE     = "wallet"
	BUY_ORDER_TYPE         = "buy"
	SELL_ORDER_TYPE        = "sell"
	DEPOSIT_ORDER_TYPE     = "deposit"
	WITHDRAWAL_ORDER_TYPE  = "withdrawal"
	TX_CATEGORY_DEPOSIT    = "deposit"
	TX_CATEGORY_WITHDRAWAL = "withdrawal"
	TX_CATEGORY_TRADE      = "trade"
	TX_CATEGORY_INCOME     = "income"
	TX_CATEGORY_GIFT       = "gift"
	TX_CATEGORY_MINING     = "mining"
	TX_CATEGORY_SPEND      = "spend"
	TX_CATEGORY_DONATION   = "donation"
	TX_CATEGORY_LOST       = "lost"
	TX_CATEGORY_TRANSFER   = "transfer"
)
View Source
const TokenABI = `` /* 1770-byte string literal not displayed */

TokenABI is the input ABI used to generate the binding from.

Variables

View Source
var CryptoCurrencies = map[string]string{}/* 2344 elements not displayed */
View Source
var FiatCurrencies = map[string]*Currency{
	"USD": &Currency{
		ID:           "USD",
		Name:         "United States dollar",
		Symbol:       "$",
		BaseUnit:     100,
		DecimalPlace: 2},
	"CAD": &Currency{
		ID:           "CAD",
		Name:         "Canadian dollar",
		Symbol:       "$",
		BaseUnit:     100,
		DecimalPlace: 2},
	"EUR": &Currency{
		ID:           "EUR",
		Name:         "Euro",
		Symbol:       "€",
		BaseUnit:     100,
		DecimalPlace: 2},
	"JPY": &Currency{
		ID:           "JPY",
		Name:         "Japanese yen",
		Symbol:       "¥",
		BaseUnit:     100,
		DecimalPlace: 2},
	"GBP": &Currency{
		ID:           "GBP",
		Symbol:       "£",
		BaseUnit:     100,
		DecimalPlace: 2},
	"CHF": &Currency{
		ID:           "CHF",
		Name:         "Swiss franc",
		Symbol:       "Fr",
		BaseUnit:     100,
		DecimalPlace: 2},
	"KRW": &Currency{
		ID:           "KRW",
		Name:         "South Korean won",
		Symbol:       "₩",
		BaseUnit:     100,
		DecimalPlace: 2}}

Functions

func NewCandlestickPeriod

func NewCandlestickPeriod(period int) time.Time

Types

type Candlestick

type Candlestick struct {
	Exchange     string          `json:"exchange"`
	CurrencyPair *CurrencyPair   `json:"currency_pair"`
	Period       int             `json:"period"`
	Date         time.Time       `json:"date"`
	Open         decimal.Decimal `json:"open"`
	Close        decimal.Decimal `json:"close"`
	High         decimal.Decimal `json:"high"`
	Low          decimal.Decimal `json:"low"`
	Volume       decimal.Decimal `json:"volume"`
}

func CreateCandlestick

func CreateCandlestick(exchangeName string, currencyPair *CurrencyPair, period int, prices []decimal.Decimal) *Candlestick

func (*Candlestick) String

func (candle *Candlestick) String() string

type Chart

type Chart interface {
	GetId() uint
	GetBase() string
	GetQuote() string
	GetExchange() string
	GetPeriod() int
	GetPrice() float64
	GetAutoTrade() uint
	IsAutoTrade() bool
	GetIndicators() []ChartIndicator
	GetStrategies() []ChartStrategy
	GetTrades() []Trade
	ToJSON() (string, error)
}

type ChartData

type ChartData struct {
	CurrencyPair CurrencyPair      `json:"currency"`
	Exchange     string            `json:"exchange"`
	Price        float64           `json:"price"`
	Satoshis     float64           `json:"satoshis"`
	Indicators   map[string]string `json:"indicators"`
}

type ChartIndicator

type ChartIndicator interface {
	GetId() uint
	GetChartId() uint
	GetName() string
	GetParameters() string
	GetFilename() string
}

type ChartStrategy

type ChartStrategy interface {
	GetId() uint
	GetChartId() uint
	GetName() string
	GetParameters() string
	GetFilename() string
}

type ChartTradingStrategy

type ChartTradingStrategy interface {
	GetId() uint
	GetChartId() uint
	GetName() string
	GetParameters() string
	GetDefaultParameters() string
	GetRequiredIndicators() string
}

type Coin

type Coin interface {
	GetCurrency() string
	GetPrice() decimal.Decimal
	GetExchange() string
	GetBalance() decimal.Decimal
	GetAvailable() decimal.Decimal
	GetPending() decimal.Decimal
	GetAddress() string
	GetTotal() decimal.Decimal
	GetBTC() decimal.Decimal
	GetUSD() decimal.Decimal
	IsBitcoin() bool
}

type Context

type Context interface {
	GetAppRoot() string
	GetLogger() *logging.Logger
	GetCoreDB() *gorm.DB
	GetPriceDB() *gorm.DB
	GetUser() UserContext
	SetUser(user UserContext)
	GetDebug() bool
	GetSSL() bool
	GetIPC() string
	GetKeystore() string
	GetEthereumMode() string
	Close()
}

type CryptoExchangeSummary

type CryptoExchangeSummary interface {
	GetName() string
	GetURL() string
	GetTotal() decimal.Decimal
	GetSatoshis() decimal.Decimal
	GetCoins() []Coin
}

type Ctx

type Ctx struct {
	AppRoot      string
	Logger       *logging.Logger
	CoreDB       *gorm.DB
	PriceDB      *gorm.DB
	User         UserContext
	Debug        bool
	SSL          bool
	IPC          string
	Keystore     string
	EthereumMode string
	Context
}

func (*Ctx) Close

func (c *Ctx) Close()

func (*Ctx) GetAppRoot

func (c *Ctx) GetAppRoot() string

func (*Ctx) GetCoreDB

func (c *Ctx) GetCoreDB() *gorm.DB

func (*Ctx) GetDebug

func (c *Ctx) GetDebug() bool

func (*Ctx) GetEthereumMode

func (c *Ctx) GetEthereumMode() string

func (*Ctx) GetIPC

func (c *Ctx) GetIPC() string

func (*Ctx) GetKeystore

func (c *Ctx) GetKeystore() string

func (*Ctx) GetLogger

func (c *Ctx) GetLogger() *logging.Logger

func (*Ctx) GetPriceDB

func (c *Ctx) GetPriceDB() *gorm.DB

func (*Ctx) GetSSL

func (c *Ctx) GetSSL() bool

func (*Ctx) GetUser

func (c *Ctx) GetUser() UserContext

func (*Ctx) SetUser

func (c *Ctx) SetUser(user UserContext)

type Currency

type Currency struct {
	ID           string          `json:"id"`
	Name         string          `json:"name"`
	Symbol       string          `json:"symbol"`
	BaseUnit     int32           `json:"base_unit"`
	DecimalPlace int32           `json:"decimal_place"`
	TxFee        decimal.Decimal `json:"tx_fee"`
}

func (*Currency) GetBaseUnit

func (c *Currency) GetBaseUnit() int32

func (*Currency) GetDecimalPlace

func (c *Currency) GetDecimalPlace() int32

func (*Currency) GetID

func (c *Currency) GetID() string

func (*Currency) GetName

func (c *Currency) GetName() string

func (*Currency) GetSymbol

func (c *Currency) GetSymbol() string

func (*Currency) GetTransactionFee

func (c *Currency) GetTransactionFee() decimal.Decimal

func (*Currency) IsCrypto

func (c *Currency) IsCrypto() bool

func (*Currency) IsFiat

func (c *Currency) IsFiat() bool

func (*Currency) String

func (c *Currency) String() string

type CurrencyPair

type CurrencyPair struct {
	Base          string `json:"base"`
	Quote         string `json:"quote"`
	LocalCurrency string `json:"local_currency"`
}

func NewCurrencyPair

func NewCurrencyPair(currencyPair, localCurrency string) (*CurrencyPair, error)

func (*CurrencyPair) Equals

func (cp *CurrencyPair) Equals(currencyPair *CurrencyPair) bool

func (*CurrencyPair) String

func (cp *CurrencyPair) String() string

type DatabaseImpl

type DatabaseImpl struct {
	DatabaseManager
	// contains filtered or unexported fields
}

func (*DatabaseImpl) Close

func (database *DatabaseImpl) Close(db *gorm.DB)

func (*DatabaseImpl) ConnectCoreDB

func (database *DatabaseImpl) ConnectCoreDB() *gorm.DB

func (*DatabaseImpl) ConnectPriceDB

func (database *DatabaseImpl) ConnectPriceDB() *gorm.DB

func (*DatabaseImpl) DropCoreDB

func (database *DatabaseImpl) DropCoreDB()

func (*DatabaseImpl) DropPriceDB

func (database *DatabaseImpl) DropPriceDB()

func (*DatabaseImpl) MigrateCoreDB

func (database *DatabaseImpl) MigrateCoreDB()

func (*DatabaseImpl) MigratePriceDB

func (database *DatabaseImpl) MigratePriceDB()

type DatabaseManager

type DatabaseManager interface {
	ConnectCoreDB() *gorm.DB
	MigrateCoreDB()
	DropCoreDB()
	ConnectPriceDB() *gorm.DB
	MigratePriceDB()
	DropPriceDB()
	Close(*gorm.DB)
}

func CreateDatabase

func CreateDatabase(directory, prefix string, debugMode bool) DatabaseManager

func NewDatabase

func NewDatabase() DatabaseManager

type EthereumContract

type EthereumContract interface {
	GetAddress() string
	GetSource() string
	GetBin() string
	GetABI() string
	GetCreationDate() time.Time
}

type EthereumToken

type EthereumToken interface {
	GetName() string
	GetSymbol() string
	GetDecimals() uint8
	GetBalance() decimal.Decimal
	GetWalletAddress() string
	GetContractAddress() string
	GetValue() decimal.Decimal
}

type Exchange

type Exchange interface {
	GetName() string
	GetDisplayName() string
	GetBalances() ([]Coin, decimal.Decimal)
	GetSummary() CryptoExchangeSummary
	GetNetWorth() decimal.Decimal
	GetTradingFee() decimal.Decimal
	//GetCurrencies() []string
	SubscribeToLiveFeed(currencyPair *CurrencyPair, price chan PriceChange)
	GetPrice(currencyPair *CurrencyPair) decimal.Decimal
	GetPriceHistory(currencyPair *CurrencyPair, start, end time.Time, granularity int) ([]Candlestick, error)
	GetOrderHistory(currencyPair *CurrencyPair) []Transaction
	GetDepositHistory() ([]Transaction, error)
	GetWithdrawalHistory() ([]Transaction, error)
	GetCurrencies() (map[string]*Currency, error)
	FormattedCurrencyPair(currencyPair *CurrencyPair) string
	ParseImport(file string) ([]Transaction, error)
}

type FiatPriceService

type FiatPriceService interface {
	GetPriceAt(currency string, date time.Time) (*Candlestick, error)
}

type FinancialIndicator

type FinancialIndicator interface {
	GetDefaultParameters() []string
	GetParameters() []string
	GetDisplayName() string
	GetName() string
	PeriodListener
}

type GlobalMarketCap

type GlobalMarketCap struct {
	TotalMarketCapUSD float64 `json:"total_market_cap_usd"`
	Total24HVolumeUSD float64 `json:"total_24h_volume_usd"`
	BitcoinDominance  float64 `json:"bitcoin_percentage_of_market_cap"`
	ActiveCurrencies  float64 `json:"active_currencies"`
	ActiveMarkets     float64 `json:"active_markets"`
	LastUpdated       int64   `json:"last_updated"`
}

type HttpWriter

type HttpWriter interface {
	Write(w http.ResponseWriter, status int, response interface{})
}

type JsonResponse

type JsonResponse struct {
	Error   string      `json:"error"`
	Success bool        `json:"success"`
	Payload interface{} `json:"payload"`
}

type JsonWriter

type JsonWriter struct {
	HttpWriter
}

func NewJsonWriter

func NewJsonWriter() *JsonWriter

func (*JsonWriter) Write

func (writer *JsonWriter) Write(w http.ResponseWriter, status int, response interface{})

type KeyPair

type KeyPair interface {
	GetDirectory() string
	GetPrivateKey() *rsa.PrivateKey
	GetPrivateBytes() []byte
	GetPublicKey() *rsa.PublicKey
	GetPublicBytes() []byte
}

func CreateRsaKeyPair

func CreateRsaKeyPair(ctx Context, directory string) (KeyPair, error)

func NewRsaKeyPair

func NewRsaKeyPair(ctx Context) (KeyPair, error)

type MarketCap

type MarketCap struct {
	Id               string `json:"id"`
	Name             string `json:"name"`
	Symbol           string `json:"symbol"`
	Rank             string `json:"rank"`
	PriceUSD         string `json:"price_usd"`
	PriceBTC         string `json:"price_btc"`
	VolumeUSD24h     string `json:"24h_volume_usd"`
	MarketCapUSD     string `json:"market_cap_usd"`
	AvailableSupply  string `json:"available_supply"`
	TotalSupply      string `json:"total_supply"`
	MaxSupply        string `json:"max_supply"`
	PercentChange1h  string `json:"percent_change_1h"`
	PercentChange24h string `json:"percent_change_24h"`
	PercentChange7d  string `json:"percent_change_7d"`
	LastUpdated      string `json:"last_updated"`
}

type MarketCapService

type MarketCapService interface {
	GetMarkets() []MarketCap
	GetMarket(symbol string) MarketCap
	GetGlobalMarket(currency string) *GlobalMarketCap
	GetMarketsByPrice(order string) []MarketCap
	GetMarketsByPercentChange1H(order string) []MarketCap
	GetMarketsByPercentChange24H(order string) []MarketCap
	GetMarketsByPercentChange7D(order string) []MarketCap
	GetMarketsByTopPerformers(order string) []MarketCap
	GetTrendingMarkets(order string) []MarketCap
}

type PeriodListener

type PeriodListener interface {
	OnPeriodChange(candlestick *Candlestick)
}

type Plugin

type Plugin interface {
	GetName() string
	GetFilename() string
	GetVersion() string
	GetType() string
}

type Portfolio

type Portfolio interface {
	GetUser() UserContext
	GetNetWorth() decimal.Decimal
	GetExchanges() []CryptoExchangeSummary
	GetWallets() []UserCryptoWallet
	GetTokens() []EthereumToken
}

type PriceChange

type PriceChange struct {
	Exchange     string          `json:"exchange"`
	CurrencyPair *CurrencyPair   `json:"currencyPair"`
	Satoshis     decimal.Decimal `json:"satoshis"`
	Price        decimal.Decimal `json:"price"`
}

type PriceListener

type PriceListener interface {
	OnPriceChange(priceChange *PriceChange)
}

type Profit

type Profit interface {
	GetUserId() uint
	GetTradeId() uint
	GetQuantity() decimal.Decimal
	GetBought() decimal.Decimal
	GetSold() decimal.Decimal
	GetFee() decimal.Decimal
	GetTax() decimal.Decimal
	GetTotal() decimal.Decimal
}

type RateLimiter

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

func NewRateLimiter

func NewRateLimiter(maxRequests int, perSecond int) *RateLimiter

func (*RateLimiter) RespectRateLimit

func (rateLimiter *RateLimiter) RespectRateLimit()

func (*RateLimiter) String

func (rateLimiter *RateLimiter) String() string

type RsaKeyPair

type RsaKeyPair struct {
	Directory    string
	PrivateKey   *rsa.PrivateKey
	PrivateBytes []byte
	PublicKey    *rsa.PublicKey
	PublicBytes  []byte
	KeyPair
}

func (*RsaKeyPair) GetDirectory

func (keypair *RsaKeyPair) GetDirectory() string

func (*RsaKeyPair) GetPrivateBytes

func (keypair *RsaKeyPair) GetPrivateBytes() []byte

func (*RsaKeyPair) GetPrivateKey

func (keypair *RsaKeyPair) GetPrivateKey() *rsa.PrivateKey

func (*RsaKeyPair) GetPublicBytes

func (keypair *RsaKeyPair) GetPublicBytes() []byte

func (*RsaKeyPair) GetPublicKey

func (keypair *RsaKeyPair) GetPublicKey() *rsa.PublicKey

type Token

type Token struct {
	TokenCaller     // Read-only binding to the contract
	TokenTransactor // Write-only binding to the contract
}

Token is an auto generated Go binding around an Ethereum contract.

func NewToken

func NewToken(address common.Address, backend bind.ContractBackend) (*Token, error)

NewToken creates a new instance of Token, bound to a specific deployed contract.

type TokenCaller

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

TokenCaller is an auto generated read-only Go binding around an Ethereum contract.

func NewTokenCaller

func NewTokenCaller(address common.Address, caller bind.ContractCaller) (*TokenCaller, error)

NewTokenCaller creates a new read-only instance of Token, bound to a specific deployed contract.

func (*TokenCaller) Allowance

func (_Token *TokenCaller) Allowance(opts *bind.CallOpts, arg0 common.Address, arg1 common.Address) (*big.Int, error)

Allowance is a free data retrieval call binding the contract method 0xdd62ed3e.

Solidity: function allowance( address, address) constant returns(uint256)

func (*TokenCaller) BalanceOf

func (_Token *TokenCaller) BalanceOf(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error)

BalanceOf is a free data retrieval call binding the contract method 0x70a08231.

Solidity: function balanceOf( address) constant returns(uint256)

func (*TokenCaller) Decimals

func (_Token *TokenCaller) Decimals(opts *bind.CallOpts) (uint8, error)

Decimals is a free data retrieval call binding the contract method 0x313ce567.

Solidity: function decimals() constant returns(uint8)

func (*TokenCaller) Name

func (_Token *TokenCaller) Name(opts *bind.CallOpts) (string, error)

Name is a free data retrieval call binding the contract method 0x06fdde03.

Solidity: function name() constant returns(string)

func (*TokenCaller) SpentAllowance

func (_Token *TokenCaller) SpentAllowance(opts *bind.CallOpts, arg0 common.Address, arg1 common.Address) (*big.Int, error)

SpentAllowance is a free data retrieval call binding the contract method 0xdc3080f2.

Solidity: function spentAllowance( address, address) constant returns(uint256)

func (*TokenCaller) Symbol

func (_Token *TokenCaller) Symbol(opts *bind.CallOpts) (string, error)

Symbol is a free data retrieval call binding the contract method 0x95d89b41.

Solidity: function symbol() constant returns(string)

type TokenCallerRaw

type TokenCallerRaw struct {
	Contract *TokenCaller // Generic read-only contract binding to access the raw methods on
}

TokenCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.

func (*TokenCallerRaw) Call

func (_Token *TokenCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error

Call invokes the (constant) contract method with params as input values and sets the output to result. The result type might be a single field for simple returns, a slice of interfaces for anonymous returns and a struct for named returns.

type TokenCallerSession

type TokenCallerSession struct {
	Contract *TokenCaller  // Generic contract caller binding to set the session for
	CallOpts bind.CallOpts // Call options to use throughout this session
}

TokenCallerSession is an auto generated read-only Go binding around an Ethereum contract, with pre-set call options.

func (*TokenCallerSession) Allowance

func (_Token *TokenCallerSession) Allowance(arg0 common.Address, arg1 common.Address) (*big.Int, error)

Allowance is a free data retrieval call binding the contract method 0xdd62ed3e.

Solidity: function allowance( address, address) constant returns(uint256)

func (*TokenCallerSession) BalanceOf

func (_Token *TokenCallerSession) BalanceOf(arg0 common.Address) (*big.Int, error)

BalanceOf is a free data retrieval call binding the contract method 0x70a08231.

Solidity: function balanceOf( address) constant returns(uint256)

func (*TokenCallerSession) Decimals

func (_Token *TokenCallerSession) Decimals() (uint8, error)

Decimals is a free data retrieval call binding the contract method 0x313ce567.

Solidity: function decimals() constant returns(uint8)

func (*TokenCallerSession) Name

func (_Token *TokenCallerSession) Name() (string, error)

Name is a free data retrieval call binding the contract method 0x06fdde03.

Solidity: function name() constant returns(string)

func (*TokenCallerSession) SpentAllowance

func (_Token *TokenCallerSession) SpentAllowance(arg0 common.Address, arg1 common.Address) (*big.Int, error)

SpentAllowance is a free data retrieval call binding the contract method 0xdc3080f2.

Solidity: function spentAllowance( address, address) constant returns(uint256)

func (*TokenCallerSession) Symbol

func (_Token *TokenCallerSession) Symbol() (string, error)

Symbol is a free data retrieval call binding the contract method 0x95d89b41.

Solidity: function symbol() constant returns(string)

type TokenRaw

type TokenRaw struct {
	Contract *Token // Generic contract binding to access the raw methods on
}

TokenRaw is an auto generated low-level Go binding around an Ethereum contract.

func (*TokenRaw) Call

func (_Token *TokenRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error

Call invokes the (constant) contract method with params as input values and sets the output to result. The result type might be a single field for simple returns, a slice of interfaces for anonymous returns and a struct for named returns.

func (*TokenRaw) Transact

func (_Token *TokenRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error)

Transact invokes the (paid) contract method with params as input values.

func (*TokenRaw) Transfer

func (_Token *TokenRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error)

Transfer initiates a plain transaction to move funds to the contract, calling its default method if one is available.

type TokenSession

type TokenSession struct {
	Contract     *Token            // Generic contract binding to set the session for
	CallOpts     bind.CallOpts     // Call options to use throughout this session
	TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}

TokenSession is an auto generated Go binding around an Ethereum contract, with pre-set call and transact options.

func (*TokenSession) Allowance

func (_Token *TokenSession) Allowance(arg0 common.Address, arg1 common.Address) (*big.Int, error)

Allowance is a free data retrieval call binding the contract method 0xdd62ed3e.

Solidity: function allowance( address, address) constant returns(uint256)

func (*TokenSession) ApproveAndCall

func (_Token *TokenSession) ApproveAndCall(_spender common.Address, _value *big.Int, _extraData []byte) (*types.Transaction, error)

ApproveAndCall is a paid mutator transaction binding the contract method 0xcae9ca51.

Solidity: function approveAndCall(_spender address, _value uint256, _extraData bytes) returns(success bool)

func (*TokenSession) BalanceOf

func (_Token *TokenSession) BalanceOf(arg0 common.Address) (*big.Int, error)

BalanceOf is a free data retrieval call binding the contract method 0x70a08231.

Solidity: function balanceOf( address) constant returns(uint256)

func (*TokenSession) Decimals

func (_Token *TokenSession) Decimals() (uint8, error)

Decimals is a free data retrieval call binding the contract method 0x313ce567.

Solidity: function decimals() constant returns(uint8)

func (*TokenSession) Name

func (_Token *TokenSession) Name() (string, error)

Name is a free data retrieval call binding the contract method 0x06fdde03.

Solidity: function name() constant returns(string)

func (*TokenSession) SpentAllowance

func (_Token *TokenSession) SpentAllowance(arg0 common.Address, arg1 common.Address) (*big.Int, error)

SpentAllowance is a free data retrieval call binding the contract method 0xdc3080f2.

Solidity: function spentAllowance( address, address) constant returns(uint256)

func (*TokenSession) Symbol

func (_Token *TokenSession) Symbol() (string, error)

Symbol is a free data retrieval call binding the contract method 0x95d89b41.

Solidity: function symbol() constant returns(string)

func (*TokenSession) Transfer

func (_Token *TokenSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error)

Transfer is a paid mutator transaction binding the contract method 0xa9059cbb.

Solidity: function transfer(_to address, _value uint256) returns()

func (*TokenSession) TransferFrom

func (_Token *TokenSession) TransferFrom(_from common.Address, _to common.Address, _value *big.Int) (*types.Transaction, error)

TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd.

Solidity: function transferFrom(_from address, _to address, _value uint256) returns(success bool)

type TokenTransactor

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

TokenTransactor is an auto generated write-only Go binding around an Ethereum contract.

func NewTokenTransactor

func NewTokenTransactor(address common.Address, transactor bind.ContractTransactor) (*TokenTransactor, error)

NewTokenTransactor creates a new write-only instance of Token, bound to a specific deployed contract.

func (*TokenTransactor) ApproveAndCall

func (_Token *TokenTransactor) ApproveAndCall(opts *bind.TransactOpts, _spender common.Address, _value *big.Int, _extraData []byte) (*types.Transaction, error)

ApproveAndCall is a paid mutator transaction binding the contract method 0xcae9ca51.

Solidity: function approveAndCall(_spender address, _value uint256, _extraData bytes) returns(success bool)

func (*TokenTransactor) Transfer

func (_Token *TokenTransactor) Transfer(opts *bind.TransactOpts, _to common.Address, _value *big.Int) (*types.Transaction, error)

Transfer is a paid mutator transaction binding the contract method 0xa9059cbb.

Solidity: function transfer(_to address, _value uint256) returns()

func (*TokenTransactor) TransferFrom

func (_Token *TokenTransactor) TransferFrom(opts *bind.TransactOpts, _from common.Address, _to common.Address, _value *big.Int) (*types.Transaction, error)

TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd.

Solidity: function transferFrom(_from address, _to address, _value uint256) returns(success bool)

type TokenTransactorRaw

type TokenTransactorRaw struct {
	Contract *TokenTransactor // Generic write-only contract binding to access the raw methods on
}

TokenTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.

func (*TokenTransactorRaw) Transact

func (_Token *TokenTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error)

Transact invokes the (paid) contract method with params as input values.

func (*TokenTransactorRaw) Transfer

func (_Token *TokenTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error)

Transfer initiates a plain transaction to move funds to the contract, calling its default method if one is available.

type TokenTransactorSession

type TokenTransactorSession struct {
	Contract     *TokenTransactor  // Generic contract transactor binding to set the session for
	TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
}

TokenTransactorSession is an auto generated write-only Go binding around an Ethereum contract, with pre-set transact options.

func (*TokenTransactorSession) ApproveAndCall

func (_Token *TokenTransactorSession) ApproveAndCall(_spender common.Address, _value *big.Int, _extraData []byte) (*types.Transaction, error)

ApproveAndCall is a paid mutator transaction binding the contract method 0xcae9ca51.

Solidity: function approveAndCall(_spender address, _value uint256, _extraData bytes) returns(success bool)

func (*TokenTransactorSession) Transfer

func (_Token *TokenTransactorSession) Transfer(_to common.Address, _value *big.Int) (*types.Transaction, error)

Transfer is a paid mutator transaction binding the contract method 0xa9059cbb.

Solidity: function transfer(_to address, _value uint256) returns()

func (*TokenTransactorSession) TransferFrom

func (_Token *TokenTransactorSession) TransferFrom(_from common.Address, _to common.Address, _value *big.Int) (*types.Transaction, error)

TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd.

Solidity: function transferFrom(_from address, _to address, _value uint256) returns(success bool)

type Trade

type Trade interface {
	GetId() uint
	GetChartId() uint
	GetUserId() uint
	GetBase() string
	GetQuote() string
	GetExchange() string
	GetDate() time.Time
	GetType() string
	GetPrice() decimal.Decimal
	GetAmount() decimal.Decimal
	GetChartData() string
}

type TradingStrategy

type TradingStrategy interface {
	GetRequiredIndicators() []string
	Analyze() (bool, bool, map[string]string, error)
	CalculateFeeAndTax(price decimal.Decimal) (decimal.Decimal, decimal.Decimal)
	GetTradeAmounts() (decimal.Decimal, decimal.Decimal)
	GetParameters() *TradingStrategyParams
}

type TradingStrategyParams

type TradingStrategyParams struct {
	CurrencyPair *CurrencyPair
	Balances     []Coin
	Indicators   map[string]FinancialIndicator
	NewPrice     decimal.Decimal
	LastTrade    Trade
	TradeFee     decimal.Decimal
	Config       []string
}

type Transaction

type Transaction interface {
	GetId() string
	GetDate() time.Time
	GetMarketPair() *CurrencyPair
	GetCurrencyPair() *CurrencyPair
	GetType() string
	GetCategory() string
	GetNetwork() string
	GetNetworkDisplayName() string
	GetQuantity() string
	GetQuantityCurrency() string
	GetFiatQuantity() string
	GetFiatQuantityCurrency() string
	GetPrice() string
	GetPriceCurrency() string
	GetFiatPrice() string
	GetFiatPriceCurrency() string
	GetQuoteFiatPrice() string
	GetQuoteFiatPriceCurrency() string
	GetFee() string
	GetFeeCurrency() string
	GetTotal() string
	GetTotalCurrency() string
	GetFiatFee() string
	GetFiatFeeCurrency() string
	GetFiatTotal() string
	GetFiatTotalCurrency() string
	IsDeleted() bool
	String() string
}

type UserContext

type UserContext interface {
	GetId() uint
	GetUsername() string
	GetLocalCurrency() string
	GetFiatExchange() string
	GetEtherbase() string
	GetKeystore() string
}

type UserCryptoExchange

type UserCryptoExchange interface {
	GetUserID() uint
	GetName() string
	GetKey() string
	GetURL() string
	GetSecret() string
	GetExtra() string
}

type UserCryptoWallet

type UserCryptoWallet interface {
	GetAddress() string
	GetBalance() decimal.Decimal
	GetCurrency() string
	GetValue() decimal.Decimal
}

type Wallet

type Wallet interface {
	GetPrice() decimal.Decimal
	GetWallet() (UserCryptoWallet, error)
	GetTransactions() ([]Transaction, error)
}

type WalletParams

type WalletParams struct {
	Context          Context
	Address          string
	WalletUser       string
	WalletSecret     string
	WalletExtra      string
	MarketCapService MarketCapService
	FiatPriceService FiatPriceService
}

Jump to

Keyboard shortcuts

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