Skip to content

Commit

Permalink
Merge branch 'v3' into inline-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveSkender authored Mar 31, 2024
2 parents 82d3771 + 1c758cb commit b6f2751
Show file tree
Hide file tree
Showing 71 changed files with 78,415 additions and 32,023 deletions.
20 changes: 19 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,13 @@ dotnet_style_object_initializer = true:suggestion
dotnet_style_prefer_collection_expression = true:suggestion

[*.cs]
# ref: https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/csharp-formatting-options

csharp_indent_labels = one_less_than_current
csharp_using_directive_placement = outside_namespace:warning
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_static_local_function = true:suggestion
csharp_prefer_braces = true:suggestion

csharp_style_namespace_declarations = file_scoped:suggestion
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
Expand All @@ -117,6 +119,22 @@ csharp_style_prefer_not_pattern = true:suggestion
csharp_style_prefer_extended_property_pattern = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion

# braces
csharp_prefer_braces = true:suggestion

csharp_new_line_before_open_brace = methods, properties, control_blocks, types
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = false
csharp_new_line_before_members_in_anonymous_types = false
csharp_new_line_between_query_expression_clauses = false

# braces overrides
csharp_type_declaration_braces = next_line
csharp_empty_block_style = together_same_line

# diagnostic analyzers
dotnet_diagnostic.CA1303.severity = none
dotnet_diagnostic.CS1591.severity = silent
dotnet_diagnostic.IDE0058.severity = none
21 changes: 13 additions & 8 deletions .github/workflows/deploy-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ jobs:
fetch-depth: 0

- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
uses: gittools/actions/gitversion/setup@v1.1.1
with:
versionSpec: "5.x"
preferLatestVersion: true

- name: Determine version
id: gitversion
uses: gittools/actions/gitversion/execute@v0
uses: gittools/actions/gitversion/execute@v1.1.1
with:
updateAssemblyInfo: true
useConfigFile: true
Expand All @@ -51,11 +51,16 @@ jobs:
- name: Compose version
id: compose
run: |
COMPOSED_VERSION=${{ steps.gitversion.outputs.majorMinorPatch }}${{ inputs.preview && '-preview.' || '' }}${{ inputs.preview && steps.gitversion.outputs.preReleaseNumber || '' }}
COMPOSED_VERSION=${{ steps.gitversion.outputs.majorMinorPatch }}${{ inputs.preview && '-preview.' || '' }}${{ inputs.preview && steps.gitversion.outputs.preReleaseNumber || inputs.preview && github.run_number || '' }}
echo "version=$COMPOSED_VERSION" >> "$GITHUB_OUTPUT"
echo "COMPOSED_VERSION=$COMPOSED_VERSION" >> "$GITHUB_ENV"
echo "Composed version is:"
echo $COMPOSED_VERSION
- name: Update release notes URL
uses: jacobtomlinson/gha-find-replace@v3
with:
find: "<PackageReleaseNotes>https://github.com/DaveSkender/Stock.Indicators/releases</PackageReleaseNotes>"
replace: "<PackageReleaseNotes>https://github.com/DaveSkender/Stock.Indicators/releases/tag/${{ steps.compose.outputs.version }}</PackageReleaseNotes>"
regex: false

- name: Install .NET SDK
uses: actions/setup-dotnet@v4
Expand All @@ -67,7 +72,7 @@ jobs:
run: >
dotnet build src/Indicators.csproj
--configuration Release
--property:Version=$COMPOSED_VERSION
--property:Version=${{ steps.compose.outputs.version }}
--property:ContinuousIntegrationBuild=true
-warnAsError
Expand All @@ -78,7 +83,7 @@ jobs:
--no-build
--include-symbols
--output NuGet
-p:PackageVersion=$COMPOSED_VERSION
-p:PackageVersion=${{ steps.compose.outputs.version }}
- name: Save NuGet package
uses: actions/upload-artifact@v3
Expand All @@ -95,7 +100,7 @@ jobs:
echo "| Minor | ${{ steps.gitversion.outputs.minor }} |"
echo "| Patch | ${{ steps.gitversion.outputs.patch }} |"
echo "| Base | ${{ steps.gitversion.outputs.majorMinorPatch }} |"
echo "| Composed | $COMPOSED_VERSION |"
echo "| Composed | ${{ steps.compose.outputs.COMPOSED_VERSION }} |"
} >> $GITHUB_STEP_SUMMARY
deploy:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test-performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on: [workflow_dispatch]

jobs:
analyze:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:

Expand All @@ -18,14 +18,14 @@ jobs:
fetch-depth: 0

- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
uses: gittools/actions/gitversion/setup@v1.1.1
with:
versionSpec: "6.x"
versionSpec: "5.x"
preferLatestVersion: true

- name: Determine version
id: gitversion
uses: gittools/actions/gitversion/execute@v0
uses: gittools/actions/gitversion/execute@v1.1.1
with:
updateAssemblyInfo: true
useConfigFile: true
Expand All @@ -51,5 +51,5 @@ jobs:
- name: Publish summary
working-directory: tests/performance/BenchmarkDotNet.Artifacts/results
run: |
echo "### Package version $GITVERSION_FULLSEMVER" >> $GITHUB_STEP_SUMMARY
echo "### Package version ${{ steps.gitversion.outputs.fullSemVer }}" >> $GITHUB_STEP_SUMMARY
cat Tests.Performance.IndicatorPerformance-report-github.md >> $GITHUB_STEP_SUMMARY
16 changes: 7 additions & 9 deletions docs/GemFile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ GEM
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
base64 (0.2.0)
bigdecimal (3.1.6)
bigdecimal (3.1.7)
coffee-script (2.4.1)
coffee-script-source
execjs
Expand All @@ -31,10 +31,9 @@ GEM
concurrent-ruby (1.2.3)
connection_pool (2.4.1)
cssminify2 (2.0.1)
dnsruby (1.70.0)
dnsruby (1.71.0)
simpleidn (~> 0.2.1)
drb (2.2.0)
ruby2_keywords
drb (2.2.1)
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
Expand Down Expand Up @@ -107,7 +106,7 @@ GEM
nokogiri (>= 1.4)
htmlcompressor (0.4.0)
http_parser.rb (0.8.0)
i18n (1.14.1)
i18n (1.14.4)
concurrent-ruby (~> 1.0)
jekyll (3.9.5)
addressable (~> 2.4)
Expand Down Expand Up @@ -242,13 +241,13 @@ GEM
jekyll (>= 3.5, < 5.0)
jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1)
minitest (5.22.2)
minitest (5.22.3)
mutex_m (0.2.0)
net-http (0.4.1)
uri
nokogiri (1.16.2-x64-mingw-ucrt)
nokogiri (1.16.3-x64-mingw-ucrt)
racc (~> 1.4)
nokogiri (1.16.2-x86_64-linux)
nokogiri (1.16.3-x86_64-linux)
racc (~> 1.4)
octokit (4.25.1)
faraday (>= 1, < 3)
Expand All @@ -263,7 +262,6 @@ GEM
ffi (~> 1.0)
rexml (3.2.6)
rouge (3.30.0)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
safe_yaml (1.0.5)
sass (3.7.4)
Expand Down
38 changes: 38 additions & 0 deletions docs/examples/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# top-most EditorConfig file
root = true

# global baselines
[*]
charset = utf-8
end_of_line = lf

indent_style = space
indent_size = 2
tab_width = 2

line_length = 150
max_line_length = 150
trim_trailing_whitespace = true
insert_final_newline = true

[*.{csproj,props,targets}]
indent_style = space
indent_size = 2

[*.yml]
indent_style = space
indent_size = 2

[*.{cs,vb}]
tab_width = 4
indent_size = 4
end_of_line = lf

#### Naming styles ####

# Naming styles

dotnet_style_namespace_match_folder = false:none

[*.cs]
dotnet_diagnostic.IDE0058.severity = none
3 changes: 1 addition & 2 deletions docs/examples/Backtest/Backtest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Skender.Stock.Indicators" Version="2.4.12" />
<PackageReference Include="Skender.Stock.Indicators" Version="2.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
12 changes: 0 additions & 12 deletions docs/examples/Backtest/GlobalSuppressions.cs

This file was deleted.

11 changes: 6 additions & 5 deletions docs/examples/Backtest/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Collections.ObjectModel;
using Newtonsoft.Json;
using System.Text.Json;
using Skender.Stock.Indicators;

namespace Backtest;
Expand All @@ -23,8 +23,7 @@ public static void Main()
*/

// fetch historical quotes from data provider
List<Quote> quotesList = [.. GetQuotesFromFeed()
];
List<Quote> quotesList = [.. GetQuotesFromFeed()];

// calculate Stochastic RSI
List<StochRsiResult> resultsList =
Expand All @@ -44,6 +43,7 @@ public static void Main()
for (int i = 1; i < quotesList.Count; i++)
{
Quote q = quotesList[i];

StochRsiResult e = resultsList[i]; // evaluation period
StochRsiResult l = resultsList[i - 1]; // last (prior) period
string cross = string.Empty;
Expand Down Expand Up @@ -112,9 +112,10 @@ or ICollection<Quote> or other IEnumerable compatible types.

string json = File.ReadAllText("quotes.data.json");

Collection<Quote> quotes = JsonConvert.DeserializeObject<IReadOnlyCollection<Quote>>(json)
Collection<Quote> quotes = JsonSerializer
.Deserialize<IReadOnlyCollection<Quote>>(json)
.ToSortedCollection();

return quotes;
}
}
}
Loading

0 comments on commit b6f2751

Please sign in to comment.