diff --git a/.github/workflows/main_automation.yml b/.github/workflows/main_automation.yml index 22374fbe..d709839a 100644 --- a/.github/workflows/main_automation.yml +++ b/.github/workflows/main_automation.yml @@ -1,154 +1,102 @@ -name: Stage/build/test/release/publish -on: - workflow_dispatch: - push: - branches: - - '*' - pull_request: - branches: - - '*' - -jobs: - build_test: - runs-on: windows-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Install .NET 7.0 - uses: actions/setup-dotnet@v1 - with: - dotnet-version: | - 7.0.x - 5.0.x - include-prerelease: true - - - name: Install JDK11 for Sonar Scanner - uses: actions/setup-java@v1 - with: - java-version: 1.11 - - - name: Install JetBrains - run: dotnet tool install JetBrains.dotCover.GlobalTool --global - - name: Install Sonar Scanner - run: dotnet tool install dotnet-sonarscanner --global - - name: Install dotnet-coverage - run: dotnet tool install dotnet-coverage --global - - name: Install CodeCov - run: dotnet tool install --global Codecov.Tool - - - name: Sonar start - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - #run: dotnet sonarscanner begin /o:"mihakralj" /k:"mihakralj_QuanTAlib" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths="./coverage.xml" - run: dotnet sonarscanner begin /o:"mihakralj" /k:"mihakralj_QuanTAlib" - /d:sonar.login="${{ secrets.SONAR_TOKEN }}" - /d:sonar.host.url="https://sonarcloud.io" - /d:sonar.cs.dotcover.reportsPaths=./coveragereport.html - - - name: Build Core DLL - run: dotnet build ./Source/QuanTAlib.csproj --verbosity normal --configuration Debug --nologo - - name: Build Quantower DLL - run: dotnet build ./Quantower/Quantower.csproj --verbosity normal --configuration Debug --nologo - - - name: dotnet Test - run: dotnet test ./Tests/Tests.csproj --verbosity normal --configuration Debug --nologo - - name: DotCover Test XML - run: dotnet dotcover test ./Tests/Tests.csproj --verbosity normal --framework net7.0 --dcReportType=DetailedXML --dcoutput=./coveragereport.xml - - name: DotCover Test HTML - run: dotnet dotcover test ./Tests/Tests.csproj --verbosity normal --framework net7.0 --dcReportType=HTML --dcoutput=./coveragereport.html -# - name: dotnet-coverage -# run: dotnet-coverage collect 'dotnet test' -f xml -o './coverage.xml' - - - name: Sonar reporter - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" - - - name: CodeCov run - run: codecov -f ./coveragereport.xml -v -t ${{ secrets.CODECOV_TOKEN }} - - - name: Codacy coverage reporter - uses: codacy/codacy-coverage-reporter-action@v1 - with: - project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} - coverage-reports: ./coveragereport.xml - - release_publish: - runs-on: windows-latest - needs: [build_test] - if: ${{ github.ref == 'refs/heads/main' }} - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Install .NET 7.0 - uses: actions/setup-dotnet@v1 - with: - dotnet-version: | - 7.0.x - 5.0.x - include-prerelease: true - - - name: Build Core DLL - run: dotnet build ./Source/QuanTAlib.csproj --configuration Release --nologo - - name: Build Quantower DLL - run: dotnet build ./Quantower/Quantower.csproj --configuration Release --nologo - - - name: Release - uses: marvinpinto/action-automatic-releases@latest - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - automatic_release_tag: "latest" - prerelease: true - title: "Latest Build" - files: /Quantower/Settings/Scripts/Indicators/QuanTAlib/*.dll - - - name: Push package to github - run: dotnet nuget push '.\Source\bin\Release\QuanTAlib.*.nupkg' - --api-key ${{ secrets.GITHUB_TOKEN }} - --source https://nuget.pkg.github.com/mihakralj/index.json -# --skip-duplicate - - - name: Push package to nuget.org - run: dotnet nuget push '.\Source\bin\Release\QuanTAlib.*.nupkg' - --api-key ${{ secrets.NUGET_DEPLOY_KEY_QUANTLIB }} - --source https://api.nuget.org/v3/index.json - --skip-duplicate - - - - -# - name: Zip DLLs -# uses: thedoctor0/zip-release@master -# with: -# type: 'zip' -# directory: \Quantower\Settings\Scripts\Indicators\QuanTAlib -# filename: QL_Quantower.zip - -# - name: Release -# uses: marvinpinto/action-automatic-releases@latest -# with: -# repo_token: "${{ secrets.GITHUB_TOKEN }}" -# automatic_release_tag: "latest" -# prerelease: true -# title: "Pre-release Build" -# files: /Quantower/Settings/Scripts/Indicators/QuanTAlib/*.zip - -# - name: Push package to nuget.org -# run: dotnet nuget push '.\Source\bin\Release\QuanTAlib.*.nupkg' -# --api-key ${{ secrets.NUGET_DEPLOY_KEY_QUANTLIB }} -# --source https://api.nuget.org/v3/index.json -# --skip-duplicate - -# - name: Push package to github -# run: dotnet nuget push '.\Source\bin\Release\QuanTAlib.*.nupkg' -# --api-key ${{ secrets.GITHUB_TOKEN }} -# --source https://nuget.pkg.github.com/mihakralj/index.json -# --skip-duplicate \ No newline at end of file +name: Stage/build/test/release/publish +on: + workflow_dispatch: + push: + branches: + - '*' + pull_request: + branches: + - '*' + +jobs: + build_test: + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Install .NET 7.0 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: | + 7.0.x + 5.0.x + include-prerelease: true + + - name: Install JDK11 for Sonar Scanner + uses: actions/setup-java@v1 + with: + java-version: 1.11 + + - name: Install JetBrains + run: dotnet tool install JetBrains.dotCover.GlobalTool --global + - name: Install Sonar Scanner + run: dotnet tool install dotnet-sonarscanner --global + - name: Install dotnet-coverage + run: dotnet tool install dotnet-coverage --global + - name: Install CodeCov + run: dotnet tool install --global Codecov.Tool + + - name: Sonar start + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + #run: dotnet sonarscanner begin /o:"mihakralj" /k:"mihakralj_QuanTAlib" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths="./coverage.xml" + run: dotnet sonarscanner begin /o:"mihakralj" /k:"mihakralj_QuanTAlib" + /d:sonar.login="${{ secrets.SONAR_TOKEN }}" + /d:sonar.host.url="https://sonarcloud.io" + /d:sonar.cs.dotcover.reportsPaths=./coveragereport.html + + - name: Build Core DLL + run: dotnet build ./Source/QuanTAlib.csproj --verbosity normal --configuration Debug --nologo + - name: Build Quantower DLL + run: dotnet build ./Quantower/Quantower.csproj --verbosity normal --configuration Debug --nologo + + - name: dotnet Test + run: dotnet test ./Tests/Tests.csproj --verbosity normal --configuration Debug --nologo + - name: DotCover Test XML + run: dotnet dotcover test ./Tests/Tests.csproj --verbosity normal --framework net7.0 --dcReportType=DetailedXML --dcoutput=./coveragereport.xml + - name: DotCover Test HTML + run: dotnet dotcover test ./Tests/Tests.csproj --verbosity normal --framework net7.0 --dcReportType=HTML --dcoutput=./coveragereport.html +# - name: dotnet-coverage +# run: dotnet-coverage collect 'dotnet test' -f xml -o './coverage.xml' + + - name: Sonar reporter + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: dotnet sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" + + - name: CodeCov run + run: codecov -f ./coveragereport.xml -v -t ${{ secrets.CODECOV_TOKEN }} + + - name: Codacy coverage reporter + uses: codacy/codacy-coverage-reporter-action@v1 + with: + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + coverage-reports: ./coveragereport.xml + + - name: Release + uses: marvinpinto/action-automatic-releases@latest + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "latest" + prerelease: true + title: "Latest Build" + files: /Quantower/Settings/Scripts/Indicators/QuanTAlib/*.dll + + - name: Push package to github + if: ${{ github.ref == 'refs/heads/main' }} + run: dotnet nuget push '.\Source\bin\Release\QuanTAlib.*.nupkg' + --api-key ${{ secrets.GITHUB_TOKEN }} + --source https://nuget.pkg.github.com/mihakralj/index.json +# --skip-duplicate + + - name: Push package to nuget.org + if: ${{ github.ref == 'refs/heads/main' }} + run: dotnet nuget push '.\Source\bin\Release\QuanTAlib.*.nupkg' + --api-key ${{ secrets.NUGET_DEPLOY_KEY_QUANTLIB }} + --source https://api.nuget.org/v3/index.json + --skip-duplicate \ No newline at end of file diff --git a/.gitignore b/.gitignore index 26f94210..5c1b519b 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ .vscode/ *.deps.json .Sandbox/ +.DS_Store # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs diff --git a/Quantower/Indicators/ATR_chart.cs b/Quantower/Indicators/ATR_chart.cs index e069ae18..ae9795a3 100644 --- a/Quantower/Indicators/ATR_chart.cs +++ b/Quantower/Indicators/ATR_chart.cs @@ -1,46 +1,46 @@ -using System.Drawing; -using TradingPlatform.BusinessLayer; -namespace QuanTAlib; - -public class ATR_chart : Indicator -{ - #region Parameters - - [InputParameter("Smoothing period", 0, 1, 999, 1, 1)] - private readonly int Period = 10; - - #endregion Parameters - - private TBars bars; - - /////// - private ATR_Series indicator; - /////// - - public ATR_chart() - { - this.SeparateWindow = true; - this.Name = "ATR - Average True Range"; - this.Description = "Average True Range description"; - this.AddLineSeries("ATR", Color.RoyalBlue, 3, LineStyle.Solid); - } - - protected override void OnInit() - { - this.ShortName = "ATR (" + this.Period + ")"; - this.bars = new(); -this.indicator = new(source: bars, period: this.Period, useNaN: false); +using System.Drawing; +using TradingPlatform.BusinessLayer; +namespace QuanTAlib; + +public class ATR_chart : Indicator +{ + #region Parameters + + [InputParameter("Smoothing period", 0, 1, 999, 1, 1)] + private readonly int Period = 10; + + #endregion Parameters + + private TBars bars; + + /////// + private ATR_Series indicator; + /////// + + public ATR_chart() + { + this.SeparateWindow = true; + this.Name = "ATR - Average True Range"; + this.Description = "Average True Range description"; + this.AddLineSeries("ATR", Color.RoyalBlue, 3, LineStyle.Solid); } - protected override void OnUpdate(UpdateArgs args) - { - bool update = !(args.Reason == UpdateReason.NewBar || - args.Reason == UpdateReason.HistoricalBar); - this.bars.Add(this.Time(), this.GetPrice(PriceType.Open), - this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low), - this.GetPrice(PriceType.Close), - this.GetPrice(PriceType.Volume), update); - double result = this.indicator[this.indicator.Count - 1].v; - this.SetValue(result); - } -} + protected override void OnInit() + { + this.ShortName = "ATR (" + this.Period + ")"; + this.bars = new(); +this.indicator = new(source: bars, period: this.Period, useNaN: false); + } + + protected override void OnUpdate(UpdateArgs args) + { + bool update = !(args.Reason == UpdateReason.NewBar || + args.Reason == UpdateReason.HistoricalBar); + this.bars.Add(this.Time(), this.GetPrice(PriceType.Open), + this.GetPrice(PriceType.High), this.GetPrice(PriceType.Low), + this.GetPrice(PriceType.Close), + this.GetPrice(PriceType.Volume), update); + double result = this.indicator[this.indicator.Count - 1].v; + this.SetValue(result); + } +} diff --git a/Quantower/Quantower.csproj b/Quantower/Quantower.csproj index 853a4d15..cdf21a7c 100644 --- a/Quantower/Quantower.csproj +++ b/Quantower/Quantower.csproj @@ -1,49 +1,49 @@ - - - - net48 - latest - true - AnyCPU - Indicator - Quantower_QTAlib - QuanTAlib - embedded - preview - AnyCPU - disable - False - - - - True - 3 - True - anycpu - full - - - - embedded - True - 3 - True - anycpu - - - - - QuanTAlib\%(RecursiveDir)%(Filename)%(Extension) - - - - - - - - - - .\dll\TradingPlatform.BusinessLayer.dll - - - + + + + net48 + latest + true + AnyCPU + Indicator + Quantower_QTAlib + QuanTAlib + embedded + preview + AnyCPU + disable + False + + + + True + 3 + True + anycpu + full + + + + embedded + True + 3 + True + anycpu + + + + + QuanTAlib\%(RecursiveDir)%(Filename)%(Extension) + + + + + + + + + + .\dll\TradingPlatform.BusinessLayer.dll + + +