TraderShop.Financials.TdAmeritrade.PriceHistory 2.0.0

.NET 7.0
dotnet add package TraderShop.Financials.TdAmeritrade.PriceHistory --version 2.0.0
NuGet\Install-Package TraderShop.Financials.TdAmeritrade.PriceHistory -Version 2.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TraderShop.Financials.TdAmeritrade.PriceHistory" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TraderShop.Financials.TdAmeritrade.PriceHistory --version 2.0.0
#r "nuget: TraderShop.Financials.TdAmeritrade.PriceHistory, 2.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install TraderShop.Financials.TdAmeritrade.PriceHistory as a Cake Addin
#addin nuget:?package=TraderShop.Financials.TdAmeritrade.PriceHistory&version=2.0.0

// Install TraderShop.Financials.TdAmeritrade.PriceHistory as a Cake Tool
#tool nuget:?package=TraderShop.Financials.TdAmeritrade.PriceHistory&version=2.0.0

Price History Library

<img src="https://img.shields.io/github/issues/ucrengineer/TraderShop.Financials" alt = "home screen" style = "float: left"/> <img src="https://img.shields.io/github/forks/ucrengineer/TraderShop.Financials" alt = "home screen" style = "float: left"/> <img src="https://img.shields.io/github/stars/ucrengineer/TraderShop.Financials" alt = "home screen" style = "float: left"/> <img src="https://img.shields.io/github/license/ucrengineer/TraderShop.Financials.TdAmeritrade" alt = "home screen" style = "float: left"/>

<br></br> <a href="https://www.buymeacoffee.com/ucrengineer" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a>

<br></br> TdAmeritrade API PriceHistory Documentation

Usage

    public class PriceHistoryProviderDemo
    {
        private readonly ITdAmeritradePriceHistoryProvider _priceHistoryProvider;

        public PriceHistoryProviderDemo(ITdAmeritradePriceHistoryProvider priceHistoryProvider)
        {
            _priceHistoryProvider = priceHistoryProvider;
        }

        public async Task Return_PriceHistory_Successfully()
        {
            var result = await _priceHistoryProvider.GetPriceHistory(new PriceHistorySpecs());

            Assert.NotNull(result);
            Assert.Contains(result, x => x.Close != 0);
        }
              
        // Input model  
        public class PriceHistorySpecs
        {
            /// Instrument symbol. Default is AAPL.
            public string Symbol { get; set; } = "AAPL";
    
            /// The type of period to show. Default is <b>day</b>.
            public PeriodType PeriodType { get; set; } = PeriodType.year;
    
            /// The number of periods to show. Valid periods by periodType (defaults marked with an asterisk):
            public int Period { get; set; } = 1;
    
            /// The type of frequency with which a new candle is formed.
            /// Valid frequencyTypes by periodType (defaults marked with an asterisk):
            public FrequecyType FrequecyType { get; set; } = FrequecyType.daily;
            /// The number of the frequencyType to be included in each candle.
            /// Valid frequencies by frequencyType (defaults marked with an asterisk):
    
            public int Frequency { get; set; } = 1;
            /// End date as milliseconds since epoch.
            /// If startDate and endDate are provided, period should not be provided.
            /// Default is previous trading day.
            public DateTimeOffset EndDate { get; set; } = DateTimeOffset.Now.AddDays(-1);
    
            /// Start date as milliseconds since epoch. If startDate and endDate are provided, period should not be provided.
            public DateTimeOffset StartDate { get; set; } = DateTimeOffset.Now.AddYears(-1);
    
            /// <b>true</b> to return <b>extended hours data</b>,<b>false</b> for <b>regular market hours</b> only.<b>Default</b>  is <b>true</b>.
            public bool NeedExtendedHoursData { get; set; } = true;
    
        }
    
        public enum PeriodType
        {
            day,
            month,
            year,
            ytd
        }
    
        public enum FrequecyType
        {
            minute,
            daily,
            weekly,
            monthly
        }
        
        // output model 
            public class Candle
        {
            public decimal Close { get; set; }
    
            public long DateTime { get; set; }
    
            public decimal High { get; set; }
    
            public decimal Low { get; set; }
    
            public decimal Open { get; set; }
    
            public long Volume { get; set; }
        }
    
        public class PriceHistoryRoot
        {
            public Candle[] Candles { get; set; } = new Candle[0];
    
            public bool Empty { get; set; }
    
            public string Symbmol { get; set; } = string.Empty;
    
        }

    }

Description

This library is in charge of returning price histories for a given instrument.

Product Versions
.NET net7.0
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 53 11/21/2022
1.1.4 234 7/4/2022
1.1.3 166 6/20/2022
1.1.2 156 6/19/2022
1.0.2 167 6/10/2022
1.0.1 166 5/24/2022
1.0.0 164 5/24/2022
1.0.0-preview1 75 5/24/2022

updated contracts