TraderShop.Financials.TdAmeritrade.Orders 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package TraderShop.Financials.TdAmeritrade.Orders --version 1.0.1                
NuGet\Install-Package TraderShop.Financials.TdAmeritrade.Orders -Version 1.0.1                
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.Orders" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TraderShop.Financials.TdAmeritrade.Orders --version 1.0.1                
#r "nuget: TraderShop.Financials.TdAmeritrade.Orders, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install TraderShop.Financials.TdAmeritrade.Orders as a Cake Addin
#addin nuget:?package=TraderShop.Financials.TdAmeritrade.Orders&version=1.0.1

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

Orders 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 Documentation

Usage

  public class OrdersProvider
    {
        private readonly ITdAmeritradeOrdersProvider _ordersProvider;
        private readonly TdAmeritradeOptions _options;

        public OrdersProvider(ITdAmeritradeOrdersProvider ordersProvider, TdAmeritradeOptions options)
        {
            _ordersProvider = ordersProvider;
            _options = options;
        }

        public async Task Return_Order_Successfully()
        {
            var result = await _ordersProvider.GetOrder(_options.account_number, "5408819438");
        }

        public async Task Return_Orders_By_Path_Successfully()
        {
            var result = await _ordersProvider.GetOrdersByPath(_options.account_number, orderQuery: new OrderQuery { FromEnteredTime = DateTime.Now.AddYears(-10) });
        }

        public async Task Return_Orders_By_Query_Successfully()
        {
            var result = await _ordersProvider.GetOrdersByQuery(orderQuery: new OrderQuery() { FromEnteredTime = DateTime.Now.AddYears(-1) });
        }

        public async Task Place_Order_Successfully()
        {
            var order = new PlaceOrder("LIMIT", 100,
                "NORMAL",
                "DAY",
                "SINGLE",
                new OrderLegCollection[]
                {
                    new OrderLegCollection("BUY",1,"MSFT","EQUITY")
                });

            var result = await _ordersProvider.PlaceOrder(_options.account_number, order);
        }

        public async Task Replace_Order_Successfully()
        {
            var order = new PlaceOrder("LIMIT", 100,
                           "NORMAL",
                           "DAY",
                           "SINGLE",
                           new OrderLegCollection[]
                           {
                                        new OrderLegCollection("BUY",2,"MSFT","EQUITY")
                           });
            var result = await _ordersProvider.ReplaceOrder(_options.account_number, "5586319823", order);

        }

        public async Task Cancel_Order_Successfully()
        {
            var orders = await _ordersProvider.GetOrdersByQuery();

            var order = orders.FirstOrDefault(x => x.Status != "CANCELED");

            var result = await _ordersProvider.CancelOrder(_options.account_number, order.OrderId.ToString());

        }

        public async Task Place_Conditional_Order_Successfully()
        {
            var order = new ConditionalTriggerOrder("LIMIT", 100,
                        "NORMAL",
                        "DAY",
                        "SINGLE",
                        new OrderLegCollection[]
                        {
                            new OrderLegCollection("BUY",1,"MSFT","EQUITY")
                        },
                        new PlaceOrder[]
                        {
                            new PlaceOrder("LIMIT", 1,
                               "NORMAL",
                               "DAY",
                               "SINGLE",
                               new OrderLegCollection[]
                               {
                                            new OrderLegCollection("SELL",1,"MSFT","EQUITY")
                               })
                        });

            var result = await _ordersProvider.PlaceOrder<ConditionalTriggerOrder>(_options.account_number, order);


            var optionOrder = new OptionOrder(
                "NONE",
                "LIMIT",
                2.0,
                "NORMAL",
                "DAY",
                "SINGLE",
                new OrderLegCollection[]
                {
                    new OrderLegCollection(
                        "BUY_TO_OPEN",
                        1,
                        ".MSFT220715C245",
                        "OPTION")
                });

            var optionsResult = await _ordersProvider.PlaceOrder<OptionOrder>(_options.account_number, optionOrder);

            var verticalCallSpread = new OptionOrder(
                "VERTICAL",
                "NET_DEBIT",
                2.0,
                "NORMAL",
                "DAY",
                "SINGLE",
                new OrderLegCollection[]
                {
                    new OrderLegCollection(
                        "BUY_TO_OPEN",
                        1,
                        ".MSFT220715C245",
                        "OPTION"),
                    new OrderLegCollection(
                        "SELL_TO_OPEN",
                        1,
                        ".MSFT220617C250",
                        "OPTION"),
                });

            var optionsVerticalSpreadResult = await _ordersProvider.PlaceOrder<OptionOrder>(_options.account_number, verticalCallSpread);

            var conditionalOrder = new ConditionalTriggerOrder(
            "LIMIT",
            100,
            "NORMAL",
            "DAY",
            "TRIGGER",
            new OrderLegCollection[]
            {
                            new OrderLegCollection("BUY",1,"MSFT","EQUITY")
            },
            new PlaceOrder[]
            {
                            new PlaceOrder("LIMIT", 1,
                               "NORMAL",
                               "DAY",
                               "SINGLE",
                               new OrderLegCollection[]
                               {
                                            new OrderLegCollection("SELL",1,"MSFT","EQUITY")
                               })
            });

            var conditionalOrderResult = await _ordersProvider.PlaceOrder<ConditionalTriggerOrder>(_options.account_number, conditionalOrder);


        }
    }

Desciption

This library is in charge of interacting with the TdAmeritrade API to retrieve & place orders.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
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 407 11/21/2022
1.1.4 443 7/4/2022
1.1.3 455 6/20/2022
1.1.2 438 6/19/2022
1.0.2 442 6/10/2022
1.0.1 434 5/24/2022
1.0.0 423 5/24/2022
1.0.0-preview1 183 5/24/2022