Skip to content

Commit

Permalink
expose internal utilities (#878)
Browse files Browse the repository at this point in the history
+semver: minor
  • Loading branch information
DaveSkender authored Aug 21, 2022
1 parent 615cf57 commit a637789
Show file tree
Hide file tree
Showing 29 changed files with 213 additions and 111 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ csharp_style_var_for_built_in_types = false:warning
csharp_style_var_when_type_is_apparent = false:warning
csharp_style_var_elsewhere = false:suggestion
csharp_indent_case_contents = true
csharp_style_prefer_top_level_statements = false:silent
csharp_style_prefer_utf8_string_literals = true:suggestion
csharp_preserve_single_line_statements = false

[*.{cs,vb}]
dotnet_style_namespace_match_folder= false:silent
Expand Down
7 changes: 6 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@
"Aroon",
"Ashi",
"Atrp",
"Backtest",
"backtesting",
"betatype",
"Blau",
"Bollinger",
"Botes",
"candlepart",
"Chaikin",
"Chainable",
"Chande",
"chandeliertype",
"chartable",
Expand All @@ -54,6 +56,7 @@
"Doji",
"Donchian",
"Dreiss",
"duplicative",
"Ehlers",
"endfor",
"endtype",
Expand Down Expand Up @@ -82,6 +85,7 @@
"Legoux",
"Levshin",
"LINQ",
"livereload",
"lookback",
"Loukas",
"LSMA",
Expand All @@ -102,6 +106,7 @@
"pivottrend",
"Quong",
"Renko",
"Schaff",
"Seban",
"senkou",
"Siepman",
Expand All @@ -110,6 +115,7 @@
"Soudack",
"Starc",
"Stoch",
"Stoller",
"Swenlin",
"Tema",
"tenkan",
Expand Down Expand Up @@ -138,7 +144,6 @@
"!asciidoc",
"!c",
"!cpp",
"!csharp",
"!css",
"!elixir",
"!git-commit",
Expand Down
5 changes: 3 additions & 2 deletions docs/GemFile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
source 'https://rubygems.org'

# windows compatibilty pack
gem 'wdm', '>= 0.1.1' if Gem.win_platform?
gem 'eventmachine', '1.2.7', git: 'https://github.com/eventmachine/eventmachine', tag: 'v1.2.7'
gem 'wdm', '>= 0.1.1' if Gem.win_platform? # windows compatibilty pack
gem 'faraday-retry'

# jekyll plugins
# local dev: bundle exec jekyll serve
Expand Down
12 changes: 11 additions & 1 deletion docs/GemFile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
GIT
remote: https://github.com/eventmachine/eventmachine
revision: 9cb13a8a62363df5ebcc414169a3deb2c1608528
tag: v1.2.7
specs:
eventmachine (1.2.7)

GEM
remote: https://rubygems.org/
specs:
Expand All @@ -23,12 +30,13 @@ GEM
http_parser.rb (~> 0)
ethon (0.15.0)
ffi (>= 1.15.0)
eventmachine (1.2.7-x64-mingw32)
execjs (2.8.1)
faraday (2.5.2)
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-net_http (3.0.0)
faraday-retry (2.0.0)
faraday (~> 2.0)
ffi (1.15.5-x64-mingw32)
forwardable-extended (2.6.0)
gemoji (3.0.1)
Expand Down Expand Up @@ -271,6 +279,8 @@ PLATFORMS
x64-mingw32

DEPENDENCIES
eventmachine (= 1.2.7)!
faraday-retry
github-pages
html-proofer (~> 3.19.3)
jekyll-last-modified-at
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Explore more information:

- [Indicators and overlays]({{site.baseurl}}/indicators/#content)
- [Guide and Pro tips]({{site.baseurl}}/guide/#content)
- [Utilities and Helper functions]({{site.baseurl}}/utilities/#content)
- [Utilities and helper functions]({{site.baseurl}}/utilities/#content)
- [Demo site](https://stock-charts.azurewebsites.net) (a stock chart)
- [Example usage code]({{site.baseurl}}/examples/#content)
- [Release notes]({{site.github.repository_url}}/releases)
Expand Down
6 changes: 4 additions & 2 deletions docs/_config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ref: https://jekyllrb.com/docs/usage/
# Ref: https://github.com/pages-themes/cayman
# Local dev: bundle exec jekyll serve
# Local dev: bundle exec jekyll serve --livereload

title: "Stock Indicators for .NET"
tagline: "Send in historical price quotes and get back desired technical indicators. Nothing more."
Expand All @@ -22,15 +22,17 @@ plugins:
google_analytics: G-7602GXEZ0R

exclude: [
"*.cs",
"*.csproj",
"*.json",
"*.lock",
"*.yml",
"*.pptx",
"*.sln",
".offline",
"contributing.md",
"examples/Backtest",
"examples/ConsoleApp",
"examples/*.sln",
"GemFile",
"node_modules",
"vendor"
Expand Down
19 changes: 19 additions & 0 deletions docs/_includes/candle-properties.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#### CandleProperties

| name | type | notes
| -- |-- |--
| `Date` | DateTime | Date
| `Open` | decimal | Open price
| `High` | decimal | High price
| `Low` | decimal | Low price
| `Close` | decimal | Close price
| `Volume` | decimal | Volume
| `Size` | decimal | `High-Low`
| `Body` | decimal | `|Open-Close|`
| `UpperWick` | decimal | Upper wick size
| `LowerWick` | decimal | Lower wick size
| `BodyPct` | double | `Body/Size`
| `UpperWickPct` | double | `UpperWick/Size`
| `LowerWickPct` | double | `LowerWick/Size`
| `IsBullish` | bool | `Close>Open` direction
| `IsBearish` | bool | `Close<Open` direction
2 changes: 1 addition & 1 deletion docs/_includes/candlepart-options.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### CandlePart options
#### CandlePart options

| type | description
|-- |--
Expand Down
2 changes: 1 addition & 1 deletion docs/_indicators/StdDev.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ layout: indicator
IEnumerable<StdDevResult> results =
quotes.GetStdDev(lookbackPeriods);

// usage with optional SMA of STDEV (shown above)
// usage with optional SMA of SD (shown above)
IEnumerable<StdDevResult> results =
quotes.GetStdDev(lookbackPeriods, smaPeriods);
```
Expand Down
16 changes: 14 additions & 2 deletions docs/assets/css/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ h2 {
font-size: 1.5rem;
}
h3 {
font-size: 1.2rem;
font-size: 1.25rem;
}
h4 {
font-size: 1.1rem;
Expand Down Expand Up @@ -144,6 +144,14 @@ h5 {
}
}

// emoji
img.emoji {
height: 1rem;
width: 1rem;
padding: 0;
margin: 0;
}

// lists
ul,
ol {
Expand All @@ -153,7 +161,10 @@ h5 {
}

// tables
// td, th { }
td,
th {
font-size: 1rem;
}

td {
vertical-align: top;
Expand Down Expand Up @@ -181,6 +192,7 @@ h5 {
code {
// baseline font color
color: $color-code;
font-size: 1.1rem;

// comments
.c,
Expand Down
4 changes: 2 additions & 2 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ We are accepting these sorts of changes and requests:
We are not accepting things that should be done in your own wrapper code:

- Personal customizations and preferences
- Modified or augmented outputs that are not instrinsic
- Modified or augmented outputs that are not intrinsic

If you have general interest in contributing, but are not sure where to start, please [contact us](#contact-info) and we can help to find work in an area of interest.

Expand All @@ -37,7 +37,7 @@ Use the [Discussions](https://github.com/DaveSkender/Stock.Indicators/discussion
- Read this first: [A Step by Step Guide to Making Your First GitHub Contribution](https://codeburst.io/a-step-by-step-guide-to-making-your-first-github-contribution-5302260a2940). I also have a discussion [on Forking](https://github.com/DaveSkender/Stock.Indicators/discussions/503) if you have questions.
- If you want to work on something specific, please mention your intention on the related [Issue](https://github.com/DaveSkender/Stock.Indicators/issues). If an Issue does not exist for your contribution, please create one before starting. This will help us reserve that feature and avoid duplicative efforts.
- If you are adding a new indicator, the easiest way to do this is to copy the folder of an existing indicator and rename everything using the same naming conventions and taxonomy. All new indicators should include [tests](#testing).
- Do not comingle multiple contributions on different topics. Please keep changes small and separate.
- Do not commingle multiple contributions on different topics. Please keep changes small and separate.

## Testing

Expand Down
5 changes: 2 additions & 3 deletions docs/examples/CustomIndicators/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ public static class CustomIndicators
{
// sort quotes and convert to list
List<TQuote> quotesList = quotes
.OrderBy(x => x.Date)
.ToList();
.ToSortedList();

// initialize results
List<AtrWmaResult> results = new(quotesList.Count);
Expand All @@ -64,7 +63,7 @@ public static class CustomIndicators
Date = q.Date
};

// only do calculations after uncalculable periods
// only do calculations after incalculable periods
if (i >= lookbackPeriods - 1)
{
decimal? sumWma = 0;
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ layout: page

To help you get started, here are a few minimalist .NET 6.0 C# projects that you can review. They are complete working examples.

- `ConsoleApp` is a minimalize example of how to use the library (start here)
- `ConsoleApp` is a minimalist example of how to use the library (start here)
- `Backtest` is a slightly more complicated example of how to analyze results
- `CustomIndicatorsLibrary` shows how you can [create your own custom indicators]({{site.baseurl}}/custom-indicators/#content)
- `CustomIndicatorsUsage` shows how you'd use a custom indicator just like any other in the main library
Expand Down
20 changes: 2 additions & 18 deletions docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ redirect_from:
- [Generating indicator of indicators](#generating-indicator-of-indicators)
- [Candlestick patterns](#candlestick-patterns)
- [Creating custom indicators]({{site.baseurl}}/custom-indicators/#content)
- [Utilities and Helper functions]({{site.baseurl}}/utilities/#content)
- [Utilities and helper functions]({{site.baseurl}}/utilities/#content)
- [Contributing guidelines]({{site.github.repository_url}}/blob/main/docs/contributing.md#readme)

## Getting started
Expand Down Expand Up @@ -252,23 +252,7 @@ When a candlestick pattern is recognized, it produces a matching signal. In som

The `CandleProperties` class is an extended version of `Quote`, and contains additional calculated properties.

| name | type | notes
| -- |-- |--
| `Date` | DateTime | Date
| `Open` | decimal | Open price
| `High` | decimal | High price
| `Low` | decimal | Low price
| `Close` | decimal | Close price
| `Volume` | decimal | Volume
| `Size` | decimal | `High-Low`
| `Body` | decimal | `|Open-Close|`
| `UpperWick` | decimal | Upper wick size
| `LowerWick` | decimal | Lower wick size
| `BodyPct` | double | `Body/Size`
| `UpperWickPct` | double | `UpperWick/Size`
| `LowerWickPct` | double | `LowerWick/Size`
| `IsBullish` | bool | `Close>Open` direction
| `IsBearish` | bool | `Close<Open` direction
{% include candle-properties.md %}

## Utilities

Expand Down
Loading

0 comments on commit a637789

Please sign in to comment.