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

chore: code cleanup #1003

Merged
merged 31 commits into from
Jan 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
bbd75ca
drop use of discard variable
DaveSkender Jan 2, 2023
9008ebf
a couple test class renames (as example)
DaveSkender Jan 2, 2023
3042906
update Round syntax (examples)
DaveSkender Jan 2, 2023
3e52520
Update contributing.md
DaveSkender Jan 2, 2023
f7deb34
Update README.md
DaveSkender Jan 2, 2023
ed42892
update NuGet description
DaveSkender Jan 3, 2023
bac3364
Update README.md
DaveSkender Jan 6, 2023
c1ba742
Update base.html
DaveSkender Jan 13, 2023
6c10213
Update _config.yml
DaveSkender Jan 13, 2023
6237d13
Update base.html
DaveSkender Jan 13, 2023
5e3634d
Update _config.yml
DaveSkender Jan 13, 2023
2a967cc
Update _config.yml
DaveSkender Jan 13, 2023
67b8e6a
Merge branch 'main' into code-cleanup
DaveSkender Jan 15, 2023
d5229cb
Update README.md
DaveSkender Jan 16, 2023
748a327
Update contributing.md
DaveSkender Jan 21, 2023
b2f39ea
Update README.md
DaveSkender Jan 21, 2023
ccc9498
Update base.html
DaveSkender Jan 21, 2023
a8a505d
misc doc cleanup
DaveSkender Jan 15, 2023
4ff728e
cleanup Examples project
DaveSkender Jan 15, 2023
d799020
update analytics links
DaveSkender Jan 15, 2023
d88102f
update nuget packages
DaveSkender Jan 21, 2023
3985974
fix: inline docs URL query params
DaveSkender Jan 21, 2023
1eace00
refactor NullMath.Round usage
DaveSkender Jan 21, 2023
5204dd0
refactor: rename test namespaces
DaveSkender Jan 22, 2023
08776af
refactor: rename test classes
DaveSkender Jan 22, 2023
effda19
refactor: rename test files
DaveSkender Jan 22, 2023
48d9ce3
misc Codacy fixes
DaveSkender Jan 22, 2023
6170308
misc Codacy fixes
DaveSkender Jan 22, 2023
62ddebc
revert R# suggestion
DaveSkender Jan 22, 2023
13bfa34
remove redundamt benchmark output
DaveSkender Jan 22, 2023
a0b7b73
misc Codacy fixes
DaveSkender Jan 22, 2023
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
29 changes: 12 additions & 17 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ We pledge to act and interact in ways that contribute to an open, welcoming, div

Examples of behavior that contributes to a positive environment for our community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall community
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
- Focusing on what is best not just for us as individuals, but for the overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
- The use of sexualized language or imagery, and sexual attention or advances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Enforcement Responsibilities

Expand Down Expand Up @@ -70,13 +70,8 @@ Community leaders will follow these Community Impact Guidelines in determining t

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.0, available at [contributor-covenant.org](https://www.contributor-covenant.org/version/2/0/code_of_conduct.html).

Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
For answers to common questions about this code of conduct, [read the FAQ](https://www.contributor-covenant.org/faq) and [available translations](https://www.contributor-covenant.org/translations).
6 changes: 3 additions & 3 deletions docs/GemFile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -221,16 +221,16 @@ GEM
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.3)
listen (3.7.1)
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.3.6)
minima (2.5.1)
jekyll (>= 3.5, < 5.0)
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)
minitest (5.16.3)
nokogiri (1.13.10-x64-mingw32)
minitest (5.17.0)
nokogiri (1.14.0-x64-mingw32)
racc (~> 1.4)
octokit (4.25.1)
faraday (>= 1, < 3)
Expand Down
4 changes: 3 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ This repository uses the standard Apache 2.0 open-source license. Please review

## Give back with patronage

This software is crafted with care by unpaid enthusiasts who :heart: all forms of encouragement. If you or your organization use any of my projects or like what we're doing, please add a :star: on the [GitHub Repo]({{site.github.repository_url}}) as a token of appreciation. If you want to buy me a beer or are interest in ongoing support as a patron, [become a sponsor](https://github.com/sponsors/DaveSkender) - we'll reinvest your contributions. Patronage motivates continued maintenance and evolution of open-source projects, and to inspire new ones. Thank you for your support!
Thank you for your support! This software is crafted with care by unpaid enthusiasts who :heart: all forms of encouragement. If you or your organization use this library or like what we're doing, please add a :star: on the [GitHub Repo]({{site.github.repository_url}}) as a token of appreciation. If you want to buy me a beer or are interested in ongoing support as a patron, [become a sponsor](https://github.com/sponsors/DaveSkender). Patronage motivates continued maintenance and evolution of open-source projects, and to inspire new ones.

## Contribute to help others

Expand All @@ -88,3 +88,5 @@ Special thanks to all of our community code contributors!
</li>
{% endfor %}
</ul>

&#187; see our [full list of indicators and overlays]({{site.baseurl}}/indicators/#content)
6 changes: 5 additions & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
# Local dev: bundle exec jekyll serve --livereload

title: Stock Indicators for .NET
tagline: "Send in price quotes and get back technical indicators. Nothing more."
tagline: "Transform price quotes into trading insights."
locale: en_US

seo:
type: SoftwareApplication

# social media information
image:
path: /assets/social-banner.png
Expand All @@ -24,6 +27,7 @@ social:
author:
name: Dave Skender
twitter: daveskender
url: https://www.linkedin.com/in/skender

twitter:
username: daveskender
Expand Down
8 changes: 4 additions & 4 deletions docs/_data/categories.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
- name: Candlestick patterns
type: candlestick-pattern
subcategories:
- name: Other price patterns
type: price-pattern
- name: Other price patterns
type: price-pattern
- name: Volume-based
type: volume-based
- name: Moving averages
Expand All @@ -20,8 +20,8 @@
- name: Price characteristics
type: price-characteristic
subcategories:
- name: Numerical analysis
type: numerical-analysis
- name: Numerical analysis
type: numerical-analysis



2 changes: 1 addition & 1 deletion docs/_layouts/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
</div>

<div class="project-tagline">
Send in historical price quotes and get back desired technical indicators.
Transform price quotes into market insights and trade indicators.
<br class="not-mobile" />
Nothing more.
</div>
Expand Down
12 changes: 6 additions & 6 deletions docs/assets/icons/browserconfig.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square150x150logo src="/assets/icons/mstile-150x150.png"/>
<TileColor>#424242</TileColor>
</tile>
</msapplication>
<msapplication>
<tile>
<square150x150logo src="/assets/icons/mstile-150x150.png"/>
<TileColor>#424242</TileColor>
</tile>
</msapplication>
</browserconfig>
20 changes: 10 additions & 10 deletions docs/assets/icons/safari-pinned-tab.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 5 additions & 4 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ Use the [Discussions](https://github.com/DaveSkender/Stock.Indicators/discussion

- Review the `tests/indicators` folder for examples of unit tests. Just copy one of these.
- New indicators should be tested against manually calculated, proven, accurate results. It is helpful to include your manual calculations spreadsheet in the appropriate indicator test folder when [submitting changes](#submitting-changes).
- Historical Stock Quotes are automatically added to unit test methods. A `Data.Quotes.xlsx` Excel file is included in the `tests/_common` folder that is an exact copy of what is used in the unit tests. Use this for your manual calculations to ensure that it is correct. Do not commit changes to this Excel file.
- Historical Stock Quotes are automatically added to unit test methods. A `Data.Quotes.xlsx` Excel file is included in the `tests/_common` folder that is an exact copy of what is used in the unit tests. Use a copy of this file for your manual calculations to ensure that it is correct. Do not commit changes to the original file.
- We expect all unit tests to execute successfully and all Errors and Warning resolved before you submit your code.
- Failed builds or unit testing will block acceptance of your Pull Request when submitting changes.

### Performance benchmarking

Running the `Tests.Performance` console application in `Release` mode will produce performance data that we periodically include in the [repo documentation](https://dotnet.stockindicators.dev/performance/).
Running the `Tests.Performance` console application in `Release` mode will produce [benchmark performance data](https://dotnet.stockindicators.dev/performance/) that we include on our documentation site.

```bash
# run all performance benchmarks
Expand All @@ -71,9 +71,10 @@ dotnet run -c Release --filter *.GetAdx

This site uses [GitHub Pages](https://pages.github.com) and [Jekyll](https://jekyllrb.com) construction with Front Matter.
The documentation site is in the `docs` folder. Build the site locally to test that it works properly.
See [GitHub Pages documentation](https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/testing-your-github-pages-site-locally-with-jekyll) for initial setup instructions.
See GitHub documentation for initial [Ruby and Jekyll setup instructions for Github Pages](https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/testing-your-github-pages-site-locally-with-jekyll).

```bash
# from /docs folder
bundle install
bundle exec jekyll serve

Expand Down Expand Up @@ -141,7 +142,7 @@ This repository uses a standard Apache 2.0 open-source license. It enables open

## Contact info

[Start a new discussion, ask a question](https://github.com/DaveSkender/Stock.Indicators/discussions), or [submit an issue](https://github.com/DaveSkender/Stock.Indicators/issues) if it is publicly relevant. You can also direct message [@daveskender](https://twitter.com/messages/compose?recipient_id=27475431).
[Start a new discussion](https://github.com/DaveSkender/Stock.Indicators/discussions) or [submit an issue](https://github.com/DaveSkender/Stock.Indicators/issues) if it is publicly relevant. You can also direct message [@daveskender](https://twitter.com/messages/compose?recipient_id=27475431).

Thanks,
Dave Skender
2 changes: 1 addition & 1 deletion docs/examples/Backtest/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
"Style",
"IDE0130:Namespace does not match folder structure",
Justification = "Microsoft bug?"
)]
)]
28 changes: 14 additions & 14 deletions docs/examples/Backtest/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ public static void Main()

/* This is a basic 20-year backtest-style analysis of
* Stochastic RSI. It will buy-to-open (BTO) one share
* when the Stoch RSI (%K) is below 20 and crosses over the
* Signal (%D). The reverse Sell-to-Close (STC) and
* when the Stoch RSI (%K) is below 20 and crosses over the
* Signal (%D). The reverse Sell-to-Close (STC) and
* Sell-To-Open (STO) occurs when the Stoch RSI is above 80 and
* crosses below the Signal.
*
*
* As a result, there will always be one open LONG or SHORT
* position that is opened and closed at signal crossover
* points in the overbought and oversold regions of the indicator.
Expand All @@ -33,8 +33,8 @@ public static void Main()
// calculate Stochastic RSI
List<StochRsiResult> resultsList =
quotesList
.GetStochRsi(14, 14, 3, 1)
.ToList();
.GetStochRsi(14, 14, 3)
.ToList();

// initialize
decimal trdPrice = 0;
Expand All @@ -48,7 +48,7 @@ public static void Main()
for (int i = 1; i < quotesList.Count; i++)
{
Quote q = quotesList[i];
StochRsiResult e = resultsList[i]; // evaluation period
StochRsiResult e = resultsList[i]; // evaluation period
StochRsiResult l = resultsList[i - 1]; // last (prior) period
string cross = string.Empty;

Expand All @@ -71,7 +71,7 @@ public static void Main()

// check for SHORT event
// condition: Stoch RSI was >= 80 and Stoch RSI crosses under Signal
if (l.StochRsi >= 80
else if (l.StochRsi >= 80
&& l.StochRsi > l.Signal
&& e.StochRsi <= e.Signal
&& trdQty != -1)
Expand All @@ -86,12 +86,12 @@ public static void Main()
if (cross != string.Empty)
{
Console.WriteLine(
$"{q.Date,10:yyyy-MM-dd} " +
$"{q.Close,10:c2}" +
$"{e.StochRsi,7:N1}" +
$"{e.Signal,7:N1}" +
$"{cross,7}" +
$"{rlzGain + trdGain,13:c2}");
$"{q.Date,10:yyyy-MM-dd} " +
$"{q.Close,10:c2}" +
$"{e.StochRsi,7:N1}" +
$"{e.Signal,7:N1}" +
$"{cross,7}" +
$"{rlzGain + trdGain,13:c2}");
}
}
}
Expand Down Expand Up @@ -121,4 +121,4 @@ or ICollection<Quote> or other IEnumerable compatible types.

return quotes;
}
}
}
2 changes: 1 addition & 1 deletion docs/examples/ConsoleApp/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
"Style",
"IDE0130:Namespace does not match folder structure",
Justification = "Microsoft bug?"
)]
)]
7 changes: 3 additions & 4 deletions docs/examples/ConsoleApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public class Program
{
public static void Main()
{

// fetch historical quotes from data provider
IEnumerable<Quote> quotes = GetHistoryFromFeed();

Expand All @@ -24,8 +23,8 @@ public static void Main()
Console.WriteLine("SMA Results ---------------------------");

foreach (SmaResult r in results.TakeLast(10))
// only showing last 10 records for brevity
{
// only showing last 10 records for brevity
Console.WriteLine($"SMA on {r.Date:u} was ${r.Sma:N3}");
}

Expand Down Expand Up @@ -68,7 +67,7 @@ with the same ordinal position.
bool isBullish = (double)q.Close > r.Sma;

Console.WriteLine($"SMA on {r.Date:u} was ${r.Sma:N3}"
+ $" and Bullishness is {isBullish}");
+ $" and Bullishness is {isBullish}");
}
}

Expand Down Expand Up @@ -97,4 +96,4 @@ or ICollection<Quote> or other IEnumerable compatible types.

return quotes;
}
}
}
2 changes: 1 addition & 1 deletion docs/examples/CustomIndicators/AtrWma.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ public static IEnumerable<AtrWmaResult> GetAtrWma<TQuote>(

return results;
}
}
}
5 changes: 2 additions & 3 deletions docs/examples/CustomIndicatorsUsage/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public class Program
{
public static void Main()
{

// fetch historical quotes from data provider
IEnumerable<Quote> quotes = GetHistoryFromFeed();

Expand All @@ -24,8 +23,8 @@ public static void Main()
Console.WriteLine("ATR WMA Results ---------------------------");

foreach (AtrWmaResult r in results.Take(30))
// only showing first 30 records for brevity
{
// only showing first 30 records for brevity
Console.WriteLine($"ATR WMA on {r.Date:u} was ${r.AtrWma:N3}");
}

Expand Down Expand Up @@ -73,4 +72,4 @@ or ICollection<Quote> or other IEnumerable compatible types.

return quotes;
}
}
}
2 changes: 1 addition & 1 deletion src/Indicators.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Authors>Dave Skender</Authors>
<Product>Stock Indicators for .NET</Product>
<Copyright>@2020 Dave Skender</Copyright>
<Description>Stock Indicators for .NET. Send in historical price quotes and get back desired technical indicators such as Stochastic RSI, Average True Range, Parabolic SAR, etc. Nothing more.</Description>
<Description>Stock Indicators for .NET. Send in price quotes and get back desired technical analysis indicators such as MACD, Stochastic RSI, Average True Range, Parabolic SAR, etc. Nothing more.</Description>

<RepositoryUrl>https://github.com/DaveSkender/Stock.Indicators</RepositoryUrl>
<RepositoryType>git</RepositoryType>
Expand Down
4 changes: 2 additions & 2 deletions src/_common/Generics/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<type name="Find">
<summary> Finds time series values on a specific date.
<para>
See <see href="https://dotnet.StockIndicators.dev/utilities/#find-indicator-result-by-date?utm_source=library">documentation</see> for more information.
See <see href="https://dotnet.StockIndicators.dev/utilities/#find-indicator-result-by-date?utm_source=library&amp;utm_medium=inline-help&amp;utm_campaign=embedded">documentation</see> for more information.
</para>
</summary>
<typeparam name="TSeries">Any series type.</typeparam>
Expand All @@ -16,7 +16,7 @@
<type name="Prune">
<summary> Removes a specific quantity from the beginning of the time series list.
<para>
See <see href="https://dotnet.StockIndicators.dev/utilities/#remove-warmup-periods?utm_source=library">documentation</see> for more information.
See <see href="https://dotnet.StockIndicators.dev/utilities/#remove-warmup-periods?utm_source=library&amp;utm_medium=inline-help&amp;utm_campaign=embedded">documentation</see> for more information.
</para>
</summary>
<typeparam name="T">Any series type.</typeparam>
Expand Down
Loading