Documentation ¶
Index ¶
Constants ¶
View Source
const SECONDS_IN_DAY = 24 * 60 * 60
Variables ¶
View Source
var ( TestVolatileExchangeParams = VolatileExchangeParams{ AveragePrice: 100, Amplitude: 0.5, Frequency: 2, } TestVolatileExchangeDetails = types.ExchangeQueryDetails{ Exchange: exchange_common.EXCHANGE_ID_TEST_VOLATILE_EXCHANGE, Url: "https://www.google.com/", PriceFunction: VolatileExchangePriceFunction, IsMultiMarket: false, } )
Test Exchange used for testing purposes.
Functions ¶
func VolatileExchangePriceFunction ¶
func VolatileExchangePriceFunction( response *http.Response, tickerToExponent map[string]int32, resolver types.Resolver, ) (tickerToPrice map[string]uint64, unavailableTickers map[string]error, err error)
VolatileExchangePriceFunction generates a time-based price value based off of the following function: - PRICE = AVERAGE * (1 + AMPLITUDE * WAVE_VALUE) - WAVE_VALUE = math.Sin(RADIANS) - RADIANS = PERCENTAGE_THROUGH_DAY * FREQUENCY * 2 * math.Pi - PERCENTAGE_THROUGH_DAY = (time.Now().Unix() % SECONDS_IN_A_DAY) / SECONDS_IN_A_DAY The following values are parametrized in `VolatileExchangeParams`: - AVERAGE, AMPLITUDE, FREQUENCY
Types ¶
type VolatileExchangeParams ¶
type VolatileExchangeTicker ¶
VolatileExchangeTicker is our representation of ticker information for a test market. It implements interface `Ticker` in util.go.
func (VolatileExchangeTicker) GetAskPrice ¶
func (t VolatileExchangeTicker) GetAskPrice() string
func (VolatileExchangeTicker) GetBidPrice ¶
func (t VolatileExchangeTicker) GetBidPrice() string
func (VolatileExchangeTicker) GetLastPrice ¶
func (t VolatileExchangeTicker) GetLastPrice() string
func (VolatileExchangeTicker) GetPair ¶
func (t VolatileExchangeTicker) GetPair() string
Click to show internal directories.
Click to hide internal directories.