Skip to content

Commit

Permalink
Return fake price data for darkside test mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Larry Ruane committed Jul 15, 2022
1 parent 466b862 commit 61f35ec
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions common/prices.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ func writeHistoricalPricesMap() {
// have fetched if no more than 3 hours old, else an error. An error
// should not occur unless we can't reach enough price oracles.
func GetCurrentPrice() (float64, error) {
if DarksideEnabled {
return 222.333, nil
}
mutex.Lock()
defer mutex.Unlock()

Expand All @@ -241,6 +244,9 @@ func day(t time.Time) string {
// GetHistoricalPrice returns the price for the given day, but only
// accurate to day granularity.
func GetHistoricalPrice(ts time.Time) (float64, *time.Time, error) {
if DarksideEnabled {
return 333.444, &ts, nil
}
dt := day(ts)
canonicalTime, err := time.Parse("2006-01-02", dt)
if err != nil {
Expand Down

0 comments on commit 61f35ec

Please sign in to comment.