@gitchrisqueen/tdameritrade-api-js-client
Version:
TD Ameritrade API integration for node.js
355 lines (246 loc) • 10.3 kB
Markdown
All URIs are relative to *https://api.tdameritrade.com/v1*
Method | HTTP request | Description
------------- | ------------- | -------------
[**accountsAccountIdOrdersGET**](OrdersApi.md
[**accountsAccountIdOrdersOrderIdDELETE**](OrdersApi.md
[**accountsAccountIdOrdersOrderIdGET**](OrdersApi.md
[**accountsAccountIdOrdersOrderIdPUT**](OrdersApi.md
[**ordersGET**](OrdersApi.md
[**ordersPOST**](OrdersApi.md
<a name="accountsAccountIdOrdersGET"></a>
> OrderGet accountsAccountIdOrdersGET(accountId, opts)
Get Orders by Path
Orders for a specific account.
### Example
```javascript
var GitChrisQueen_TDA_JS = require('@gitchrisqueen/tdameritrade-api-js-client');
var defaultClient = GitChrisQueen_TDA_JS.ApiClient.instance;
// Configure API key authorization: bearerAuth
var bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearerAuth.apiKeyPrefix = 'Token';
var apiInstance = new GitChrisQueen_TDA_JS.OrdersApi();
var accountId = 56; // Number |
var opts = {
'maxResults': 56, // Number |
'fromEnteredTime': new Date("2013-10-20T19:20:30+01:00"), // Date |
'toEnteredTime': new Date("2013-10-20T19:20:30+01:00"), // Date |
'status': "status_example" // String |
};
apiInstance.accountsAccountIdOrdersGET(accountId, opts).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**accountId** | **Number**| |
**maxResults** | **Number**| | [optional]
**fromEnteredTime** | **Date**| | [optional]
**toEnteredTime** | **Date**| | [optional]
**status** | **String**| | [optional]
[**OrderGet**](OrderGet.md)
[](../README.md
- **Content-Type**: Not defined
- **Accept**: application/json
<a name="accountsAccountIdOrdersOrderIdDELETE"></a>
<<<<<<< HEAD
> EASObject accountsAccountIdOrdersOrderIdDELETE(accountId, orderId)
=======
> ErrorObject accountsAccountIdOrdersOrderIdDELETE(accountId, orderId)
>>>>>>> 506b15873e423d341909c383b7ced229ce8f1645
Cancel Order
Cancel a specific order for a spcific account
### Example
```javascript
var GitChrisQueen_TDA_JS = require('@gitchrisqueen/tdameritrade-api-js-client');
var defaultClient = GitChrisQueen_TDA_JS.ApiClient.instance;
// Configure API key authorization: bearerAuth
var bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearerAuth.apiKeyPrefix = 'Token';
var apiInstance = new GitChrisQueen_TDA_JS.OrdersApi();
var accountId = 56; // Number |
var orderId = 56; // Number |
apiInstance.accountsAccountIdOrdersOrderIdDELETE(accountId, orderId).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**accountId** | **Number**| |
**orderId** | **Number**| |
<<<<<<< HEAD
[**EASObject**](EASObject.md)
=======
[**ErrorObject**](ErrorObject.md)
>>>>>>> 506b15873e423d341909c383b7ced229ce8f1645
[](../README.md
- **Content-Type**: Not defined
- **Accept**: application/json
<a name="accountsAccountIdOrdersOrderIdGET"></a>
> OrderGet accountsAccountIdOrdersOrderIdGET(accountId, orderId)
Get Order
Get a specific order for a specific account.
### Example
```javascript
var GitChrisQueen_TDA_JS = require('@gitchrisqueen/tdameritrade-api-js-client');
var defaultClient = GitChrisQueen_TDA_JS.ApiClient.instance;
// Configure API key authorization: bearerAuth
var bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearerAuth.apiKeyPrefix = 'Token';
var apiInstance = new GitChrisQueen_TDA_JS.OrdersApi();
var accountId = 56; // Number |
var orderId = 56; // Number |
apiInstance.accountsAccountIdOrdersOrderIdGET(accountId, orderId).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**accountId** | **Number**| |
**orderId** | **Number**| |
[**OrderGet**](OrderGet.md)
[](../README.md
- **Content-Type**: Not defined
- **Accept**: application/json
<a name="accountsAccountIdOrdersOrderIdPUT"></a>
> OrderGet accountsAccountIdOrdersOrderIdPUT(accountId, orderId)
Replace Order
Replace an existing order for an account. The existing order will be replaced by the new order. Once replaced, the old order will be canceled and a new order will be created. See our Place Order Samples Guide - https://developer.tdameritrade.com/content/place-order-samples.
### Example
```javascript
var GitChrisQueen_TDA_JS = require('@gitchrisqueen/tdameritrade-api-js-client');
var defaultClient = GitChrisQueen_TDA_JS.ApiClient.instance;
// Configure API key authorization: bearerAuth
var bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearerAuth.apiKeyPrefix = 'Token';
var apiInstance = new GitChrisQueen_TDA_JS.OrdersApi();
var accountId = 56; // Number |
var orderId = 56; // Number |
apiInstance.accountsAccountIdOrdersOrderIdPUT(accountId, orderId).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**accountId** | **Number**| |
**orderId** | **Number**| |
[**OrderGet**](OrderGet.md)
[](../README.md
- **Content-Type**: Not defined
- **Accept**: application/json
<a name="ordersGET"></a>
> OrderGet ordersGET(opts)
Get Orders By Query
All orders for a specific account or, if account ID isn't specified, orders will be returned for all linked accounts.
### Example
```javascript
var GitChrisQueen_TDA_JS = require('@gitchrisqueen/tdameritrade-api-js-client');
var defaultClient = GitChrisQueen_TDA_JS.ApiClient.instance;
// Configure API key authorization: bearerAuth
var bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearerAuth.apiKeyPrefix = 'Token';
var apiInstance = new GitChrisQueen_TDA_JS.OrdersApi();
var opts = {
'accountId': 56, // Number |
'maxResults': 56, // Number |
'fromEnteredTime': new Date("2013-10-20T19:20:30+01:00"), // Date |
'toEnteredTime': new Date("2013-10-20T19:20:30+01:00"), // Date |
'status': "status_example" // String |
};
apiInstance.ordersGET(opts).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**accountId** | **Number**| | [optional]
**maxResults** | **Number**| | [optional]
**fromEnteredTime** | **Date**| | [optional]
**toEnteredTime** | **Date**| | [optional]
**status** | **String**| | [optional]
[**OrderGet**](OrderGet.md)
[](../README.md
- **Content-Type**: Not defined
- **Accept**: application/json
<a name="ordersPOST"></a>
> OrderGet ordersPOST(accountId, opts)
Place Order
Place an order for a specific account. See our Place Order Samples Guide - https://developer.tdameritrade.com/content/place-order-samples.
### Example
```javascript
var GitChrisQueen_TDA_JS = require('@gitchrisqueen/tdameritrade-api-js-client');
var defaultClient = GitChrisQueen_TDA_JS.ApiClient.instance;
// Configure API key authorization: bearerAuth
var bearerAuth = defaultClient.authentications['bearerAuth'];
bearerAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//bearerAuth.apiKeyPrefix = 'Token';
var apiInstance = new GitChrisQueen_TDA_JS.OrdersApi();
var accountId = 56; // Number |
var opts = {
'body': new GitChrisQueen_TDA_JS.OrderGet() // OrderGet |
};
apiInstance.ordersPOST(accountId, opts).then(function(data) {
console.log('API called successfully. Returned data: ' + data);
}, function(error) {
console.error(error);
});
```
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**accountId** | **Number**| |
**body** | [**OrderGet**](OrderGet.md)| | [optional]
[**OrderGet**](OrderGet.md)
[](../README.md
- **Content-Type**: application/Json
- **Accept**: application/json