Skip to content

Commit

Permalink
qa/spelling: Add Codespell support (thrasher-corp#1121)
Browse files Browse the repository at this point in the history
* Add codespell support

* Fix paths

* Add HTML files to exclusion list
  • Loading branch information
thrasher- authored Jan 30, 2023
1 parent c785ae7 commit a79e0d2
Show file tree
Hide file tree
Showing 108 changed files with 359 additions and 318 deletions.
4 changes: 4 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[codespell]
skip = ./.git,./web,./currency/code_types.go,*.json,*.sum,*.html
exclude-file = ./contrib/spellcheck/exclude_lines.txt
ignore-words = ./contrib/spellcheck/ignore_words.txt
13 changes: 13 additions & 0 deletions .github/workflows/spell-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: codespell
on: [push, pull_request]
jobs:
codespell:
name: Spell checker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: codespell-project/actions-codespell@master
with:
exclude_file: contrib/spellcheck/exclude_lines.txt
skip: ./.git,./web,./currency/code_types.go,*.json,*.sum,*.html
ignore_words_file: contrib/spellcheck/ignore_words.txt
4 changes: 2 additions & 2 deletions backtester/config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ See below for a set of tables and fields, expected values and what they can do
|------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------|
| name | The strategy to use | `rsi` |
| use-simultaneous-signal-processing | This denotes whether multiple currencies are processed simultaneously with the strategy function `OnSimultaneousSignals`. Eg If you have multiple CurrencySettings and only wish to purchase BTC-USDT when XRP-DOGE is 1337, this setting is useful as you can analyse both signal events to output a purchase call for BTC | `true` |
| disable-usd-tracking | If `false`, will track all currencies used in your strategy against USD equivalent candles. For example, if you are running a strategy for BTC/XRP, then the GoCryptoTrader Backtester will also retreive candles data for BTC/USD and XRP/USD to then track strategy performance against a single currency. This also tracks against USDT and other USD tracked stablecoins, so one exchange supporting USDT and another BUSD will still allow unified strategy performance analysis. If disabled, will not track against USD, this can be especially helpful when running strategies under live, database and CSV based data | `false` |
| disable-usd-tracking | If `false`, will track all currencies used in your strategy against USD equivalent candles. For example, if you are running a strategy for BTC/XRP, then the GoCryptoTrader Backtester will also retrieve candles data for BTC/USD and XRP/USD to then track strategy performance against a single currency. This also tracks against USDT and other USD tracked stablecoins, so one exchange supporting USDT and another BUSD will still allow unified strategy performance analysis. If disabled, will not track against USD, this can be especially helpful when running strategies under live, database and CSV based data | `false` |
| custom-settings | This is a map where you can enter custom settings for a strategy. The RSI strategy allows for customisation of the upper, lower and length variables to allow you to change them from 70, 30 and 14 respectively to 69, 36, 12 | `"custom-settings": { "rsi-high": 70, "rsi-low": 30, "rsi-period": 14 } ` |

#### Funding Config Settings
Expand Down Expand Up @@ -232,7 +232,7 @@ See below for a set of tables and fields, expected values and what they can do
| data-check-timer | The interval in which to check exchange API's for new data | `1000000000` |
| real-orders | Whether to place real orders with real money. Its likely you should never want to set this to true | `false` |
| close-positions-on-stop | As live trading doesn't stop until you tell it to, you can trigger a close of your position(s) when you stop the strategy | `true` |
| data-request-retry-tolerance | Rather than immediately closing a strategy on failure to retreive candle data, having a retry tolerance allows multiple attempts to return data | `3` |
| data-request-retry-tolerance | Rather than immediately closing a strategy on failure to retrieve candle data, having a retry tolerance allows multiple attempts to return data | `3` |
| data-request-retry-wait-time | How long to wait in between request retries | `500000000` |
| exchange-credentials | A list of exchange credentials. See table named `ExchangeCredentials` | |

Expand Down
12 changes: 6 additions & 6 deletions backtester/eventhandlers/portfolio/portfolio.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ func (p *Portfolio) OnFill(ev fill.Event, funds funding.IFundReleaser) (fill.Eve
return ev, nil
}

// addComplianceSnapshot gets the previous snapshot of compliance events, updates with the latest fillevent
// addComplianceSnapshot gets the previous snapshot of compliance events, updates with the latest fill event
// then saves the snapshot to the c
func (p *Portfolio) addComplianceSnapshot(fillEvent fill.Event) error {
if fillEvent == nil {
Expand All @@ -276,17 +276,17 @@ func (p *Portfolio) addComplianceSnapshot(fillEvent fill.Event) error {
return err
}
prevSnap := complianceManager.GetLatestSnapshot()
if fo := fillEvent.GetOrder(); fo != nil {
price := decimal.NewFromFloat(fo.Price)
amount := decimal.NewFromFloat(fo.Amount)
fee := decimal.NewFromFloat(fo.Fee)
if filledOrder := fillEvent.GetOrder(); filledOrder != nil {
price := decimal.NewFromFloat(filledOrder.Price)
amount := decimal.NewFromFloat(filledOrder.Amount)
fee := decimal.NewFromFloat(filledOrder.Fee)
snapOrder := compliance.SnapshotOrder{
ClosePrice: fillEvent.GetClosePrice(),
VolumeAdjustedPrice: fillEvent.GetVolumeAdjustedPrice(),
SlippageRate: fillEvent.GetSlippageRate(),
CostBasis: price.Mul(amount).Add(fee),
}
snapOrder.Order = fo
snapOrder.Order = filledOrder
prevSnap.Orders = append(prevSnap.Orders, snapOrder)
}
snap := &compliance.Snapshot{
Expand Down
2 changes: 1 addition & 1 deletion backtester/eventtypes/signal/signal_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type Signal struct {
// if there is corresponding collateral in the selected currency
// this enabled cash and carry strategies for example
FillDependentEvent Event
// CollateralCurrency is an optional paramater
// CollateralCurrency is an optional parameter
// when using futures to limit the collateral available
// to a singular currency
// eg with $5000 usd and 1 BTC, specifying BTC ensures
Expand Down
2 changes: 1 addition & 1 deletion backtester/funding/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ No. The already existing `CurrencySettings` will populate the funding manager wi
|------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------|
| name | The strategy to use | `rsi` |
| use-simultaneous-signal-processing | This denotes whether multiple currencies are processed simultaneously with the strategy function `OnSimultaneousSignals`. Eg If you have multiple CurrencySettings and only wish to purchase BTC-USDT when XRP-DOGE is 1337, this setting is useful as you can analyse both signal events to output a purchase call for BTC | `true` |
| disable-usd-tracking | If `false`, will track all currencies used in your strategy against USD equivalent candles. For example, if you are running a strategy for BTC/XRP, then the GoCryptoTrader Backtester will also retreive candles data for BTC/USD and XRP/USD to then track strategy performance against a single currency. This also tracks against USDT and other USD tracked stablecoins, so one exchange supporting USDT and another BUSD will still allow unified strategy performance analysis. If disabled, will not track against USD, this can be especially helpful when running strategies under live, database and CSV based data | `false` |
| disable-usd-tracking | If `false`, will track all currencies used in your strategy against USD equivalent candles. For example, if you are running a strategy for BTC/XRP, then the GoCryptoTrader Backtester will also retrieve candles data for BTC/USD and XRP/USD to then track strategy performance against a single currency. This also tracks against USDT and other USD tracked stablecoins, so one exchange supporting USDT and another BUSD will still allow unified strategy performance analysis. If disabled, will not track against USD, this can be especially helpful when running strategies under live, database and CSV based data | `false` |
| custom-settings | This is a map where you can enter custom settings for a strategy. The RSI strategy allows for customisation of the upper, lower and length variables to allow you to change them from 70, 30 and 14 respectively to 69, 36, 12 | `"custom-settings": { "rsi-high": 70, "rsi-low": 30, "rsi-period": 14 } ` |

#### Funding Config Settings
Expand Down
Loading

0 comments on commit a79e0d2

Please sign in to comment.