Skip to content

Commit

Permalink
Bug fix for FMV with stocks, options, forex, or crypto (#376)
Browse files Browse the repository at this point in the history
  • Loading branch information
justinpolygon authored Dec 14, 2023
1 parent c1a3a90 commit f38129e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ jobs:
name: golangci-lint
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-go@v2
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.52
version: v1.54
- name: gofmt
run: |
go fmt ./...
Expand Down
13 changes: 9 additions & 4 deletions websocket/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,21 @@ const (
)

func (m Market) supports(topic Topic) bool {
// FMV is supported for Stocks, Options, Forex, and Crypto but is not within the range
// so we need to make sure FMV is suppored if these markets are used.
isBusinessFairMarketValue := topic == BusinessFairMarketValue

switch m {
case Stocks:
return topic > stocksMin && topic < stocksMax
return isBusinessFairMarketValue || (topic > stocksMin && topic < stocksMax)
case Options:
return topic > optionsMin && topic < optionsMax
return isBusinessFairMarketValue || (topic > optionsMin && topic < optionsMax)
case Forex:
return topic > forexMin && topic < forexMax
return isBusinessFairMarketValue || (topic > forexMin && topic < forexMax)
case Crypto:
return topic > cryptoMin && topic < cryptoMax
return isBusinessFairMarketValue || (topic > cryptoMin && topic < cryptoMax)
}

return true // assume user knows what they're doing if they use some unknown market
}

Expand Down

0 comments on commit f38129e

Please sign in to comment.