Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix for FMV with stocks, options, forex, or crypto #376

Merged
merged 2 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading