-
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
3 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ var stockData = new StockData(openPrices, highPrices, lowPrices, closePrices, vo | |
var results = stockData.CalculateRelativeStrengthIndex().CalculateMovingAverageConvergenceDivergence(); | ||
``` | ||
|
||
Here is an example to get you started using the [Alpaca C# Api](https://github.com/alpacahq/alpaca-trade-api-csharp) | ||
Here is a simple example calculating default bollinger bands to get you started using the [Alpaca C# Api](https://github.com/alpacahq/alpaca-trade-api-csharp) | ||
|
||
```cs | ||
using Alpaca.Markets; | ||
|
@@ -28,15 +28,14 @@ var client = Environments.Paper.GetAlpacaDataClient(new SecretKey(paperApiKey, p | |
var bars = (await client.ListHistoricalBarsAsync(new HistoricalBarsRequest(symbol, startDate, endDate, BarTimeFrame.Day)).ConfigureAwait(false)).Items; | ||
var stockData = new StockData(bars.Select(x => x.Open), bars.Select(x => x.High), bars.Select(x => x.Low), bars.Select(x => x.Close), bars.Select(x => x.Volume), bars.Select(x => x.TimeUtc)); | ||
|
||
// simple example showing default bollinger bands | ||
var results = stockData.CalculateBollingerBands(); | ||
var upperBandList = results.OutputValues["UpperBand"]; | ||
var middleBandList = results.OutputValues["MiddleBand"]; | ||
var lowerBandList = results.OutputValues["LowerBand"]; | ||
``` | ||
|
||
Here is a more advanced example showing how to calculate bollinger bands with full customization and using a custom input of high rather than the default close | ||
```cs | ||
// more advanced example showing bollinger bands with full customization and using a custom input of high rather than the default close | ||
var stockData = new StockData(bars.Select(x => x.Open), bars.Select(x => x.High), bars.Select(x => x.Low), | ||
bars.Select(x => x.Close), bars.Select(x => x.Volume), bars.Select(x => x.TimeUtc), InputName.High); | ||
|
||
|
@@ -65,4 +64,4 @@ Patreon: [https://patreon.com/cheatcountry](https://patreon.com/cheatcountry) | |
|
||
### Support or Contact | ||
|
||
Email me at [email protected] for any help or support. | ||
Email me at [email protected] for any help or support or to let me know of ways to further improve this library. |