TraderShop.Financials.TdAmeritrade.Orders
2.0.0
dotnet add package TraderShop.Financials.TdAmeritrade.Orders --version 2.0.0
NuGet\Install-Package TraderShop.Financials.TdAmeritrade.Orders -Version 2.0.0
<PackageReference Include="TraderShop.Financials.TdAmeritrade.Orders" Version="2.0.0" />
paket add TraderShop.Financials.TdAmeritrade.Orders --version 2.0.0
#r "nuget: TraderShop.Financials.TdAmeritrade.Orders, 2.0.0"
// Install TraderShop.Financials.TdAmeritrade.Orders as a Cake Addin #addin nuget:?package=TraderShop.Financials.TdAmeritrade.Orders&version=2.0.0 // Install TraderShop.Financials.TdAmeritrade.Orders as a Cake Tool #tool nuget:?package=TraderShop.Financials.TdAmeritrade.Orders&version=2.0.0
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 | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. 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. |
-
net7.0
- TraderShop.Financials.Abstractions (>= 2.0.0)
- TraderShop.Financials.TdAmeritrade.Abstractions (>= 2.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
updated contracts