This library was generated by https://konfigthis.com
$ dotnet add package SnapTrade.NetConnect brokerage accounts to your app for live positions and trading
Using the .NET Core command-line interface (CLI) tools:
dotnet add package SnapTrade.Net
Using the NuGet Command Line Interface (CLI):
nuget install SnapTrade.Net
Using the Package Manager Console:
Install-Package SnapTrade.Net
From within Visual Studio:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using SnapTrade.Net.Client;
using SnapTrade.Net.Model;
namespace Example
{
public class GetAccountActivitiesExample
{
public static void Main()
{
Snaptrade client = new Snaptrade();
// Configure custom BasePath if desired
// client.SetBasePath("https://api.snaptrade.com/api/v1");
client.SetClientId(System.Environment.GetEnvironmentVariable("SNAPTRADE_CLIENT_ID"));
client.SetConsumerKey(System.Environment.GetEnvironmentVariable("SNAPTRADE_CONSUMER_KEY"));
var accountId = "accountId_example";
var userId = "userId_example";
var userSecret = "userSecret_example";
var startDate = DateTime.Parse("2013-10-20"); // The start date (inclusive) of the transaction history to retrieve. If not provided, the default is the first transaction known to SnapTrade based on `trade_date`. (optional)
var endDate = DateTime.Parse("2013-10-20"); // The end date (inclusive) of the transaction history to retrieve. If not provided, the default is the last transaction known to SnapTrade based on `trade_date`. (optional)
var offset = 56; // An integer that specifies the starting point of the paginated results. Default is 0. (optional)
var limit = 56; // An integer that specifies the maximum number of transactions to return. Default of 1000. (optional)
var type = "BUY,SELL,DIVIDEND"; // Optional comma separated list of transaction types to filter by. SnapTrade does a best effort to categorize brokerage transaction types into a common set of values. Here are some of the most popular values: - `BUY` - Asset bought. - `SELL` - Asset sold. - `DIVIDEND` - Dividend payout. - `CONTRIBUTION` - Cash contribution. - `WITHDRAWAL` - Cash withdrawal. - `REI` - Dividend reinvestment. - `STOCK_DIVIDEND` - A type of dividend where a company distributes shares instead of cash - `INTEREST` - Interest deposited into the account. - `FEE` - Fee withdrawn from the account. - `TAX` - A tax related fee. - `OPTIONEXPIRATION` - Option expiration event. - `OPTIONASSIGNMENT` - Option assignment event. - `OPTIONEXERCISE` - Option exercise event. - `TRANSFER` - Transfer of assets from one account to another. - `SPLIT` - A stock share split. (optional)
try
{
// List account activities
PaginatedUniversalActivity result = client.AccountInformation.GetAccountActivities(accountId, userId, userSecret, startDate, endDate, offset, limit, type);
Console.WriteLine(result);
}
catch (ApiException e)
{
Console.WriteLine("Exception when calling AccountInformationApi.GetAccountActivities: " + e.Message);
Console.WriteLine("Status Code: "+ e.ErrorCode);
Console.WriteLine(e.StackTrace);
}
catch (ClientException e)
{
Console.WriteLine(e.Response.StatusCode);
Console.WriteLine(e.Response.RawContent);
Console.WriteLine(e.InnerException);
}
}
}
}
All URIs are relative to https://api.snaptrade.com/api/v1
| Class | Method | HTTP request | Description |
|---|---|---|---|
| AccountInformationApi | GetAccountActivities | GET /accounts/{accountId}/activities | List account activities |
| AccountInformationApi | GetAllUserHoldings | GET /holdings | List all accounts for the user, plus balances, positions, and orders for each account. |
| AccountInformationApi | GetUserAccountBalance | GET /accounts/{accountId}/balances | List account balances |
| AccountInformationApi | GetUserAccountDetails | GET /accounts/{accountId} | Get account detail |
| AccountInformationApi | GetUserAccountOrderDetail | POST /accounts/{accountId}/orders/details | Get account order detail |
| AccountInformationApi | GetUserAccountOrders | GET /accounts/{accountId}/orders | List account orders |
| AccountInformationApi | GetUserAccountPositions | GET /accounts/{accountId}/positions | List account positions |
| AccountInformationApi | GetUserAccountRecentOrders | GET /accounts/{accountId}/recentOrders | List account recent orders (last 24 hours only) |
| AccountInformationApi | GetUserAccountReturnRates | GET /accounts/{accountId}/returnRates | List account rate of returns |
| AccountInformationApi | GetUserHoldings | GET /accounts/{accountId}/holdings | List account holdings |
| AccountInformationApi | ListUserAccounts | GET /accounts | List accounts |
| AccountInformationApi | UpdateUserAccount | PUT /accounts/{accountId} | Update details of an investment account |
| APIStatusApi | Check | GET / | Get API Status |
| AuthenticationApi | DeleteSnapTradeUser | DELETE /snapTrade/deleteUser | Delete user |
| AuthenticationApi | ListSnapTradeUsers | GET /snapTrade/listUsers | List all users |
| AuthenticationApi | LoginSnapTradeUser | POST /snapTrade/login | Generate Connection Portal URL |
| AuthenticationApi | RegisterSnapTradeUser | POST /snapTrade/registerUser | Register user |
| AuthenticationApi | ResetSnapTradeUserSecret | POST /snapTrade/resetUserSecret | Rotate user secret |
| ConnectionsApi | DeleteConnection | DELETE /connection/{connectionId} | Delete connection |
| ConnectionsApi | DetailBrokerageAuthorization | GET /authorizations/{authorizationId} | Get connection detail |
| ConnectionsApi | DisableBrokerageAuthorization | POST /authorizations/{authorizationId}/disable | Force disable connection |
| ConnectionsApi | ListBrokerageAuthorizations | GET /authorizations | List all connections |
| ConnectionsApi | RefreshBrokerageAuthorization | POST /authorizations/{authorizationId}/refresh | Refresh holdings for a connection |
| ConnectionsApi | RemoveBrokerageAuthorization | DELETE /authorizations/{authorizationId} | Delete connection |
| ConnectionsApi | ReturnRates | GET /authorizations/{authorizationId}/returnRates | List connection rate of returns |
| ConnectionsApi | SessionEvents | GET /sessionEvents | Get all session events for a user |
| ExperimentalEndpointsApi | GetUserAccountOrderDetailV2 | GET /accounts/{accountId}/orders/details/v2/{brokerageOrderId} | Get account order detail (V2) |
| ExperimentalEndpointsApi | GetUserAccountOrdersV2 | GET /accounts/{accountId}/orders/v2 | List account orders v2 |
| ExperimentalEndpointsApi | GetUserAccountRecentOrdersV2 | GET /accounts/{accountId}/recentOrders/v2 | List account recent orders (V2, last 24 hours only) |
| OptionsApi | GetOptionQuote | GET /marketData/options/quotes | Get option quote |
| OptionsApi | GetOptionsChain | GET /accounts/{accountId}/optionsChain | Get the options chain for a symbol |
| OptionsApi | ListOptionHoldings | GET /accounts/{accountId}/options | List account option positions |
| ReferenceDataApi | GetCurrencyExchangeRatePair | GET /currencies/rates/{currencyPair} | Get exchange rate of a currency pair |
| ReferenceDataApi | GetPartnerInfo | GET /snapTrade/partners | Get Client Info |
| ReferenceDataApi | GetSecurityTypes | GET /securityTypes | List security types |
| ReferenceDataApi | GetStockExchanges | GET /exchanges | Get exchanges |
| ReferenceDataApi | GetSymbols | POST /symbols | Search symbols |
| ReferenceDataApi | GetSymbolsByTicker | GET /symbols/{query} | Get symbol detail |
| ReferenceDataApi | ListAllBrokerageAuthorizationType | GET /brokerageAuthorizationTypes | Get all brokerage authorization types |
| ReferenceDataApi | ListAllBrokerageInstruments | GET /brokerages/{slug}/instruments | Get brokerage instruments |
| ReferenceDataApi | ListAllBrokerages | GET /brokerages | Get brokerages |
| ReferenceDataApi | ListAllCurrencies | GET /currencies | Get currencies |
| ReferenceDataApi | ListAllCurrenciesRates | GET /currencies/rates | Get currency exchange rates |
| ReferenceDataApi | SymbolSearchUserAccount | POST /accounts/{accountId}/symbols | Search account symbols |
| TradingApi | CancelOrder | POST /accounts/{accountId}/trading/cancel | Cancel order |
| TradingApi | CancelUserAccountOrder | POST /accounts/{accountId}/orders/cancel | Cancel equity order |
| TradingApi | GetCryptocurrencyPairQuote | GET /accounts/{accountId}/trading/instruments/cryptocurrencyPairs/{instrumentSymbol}/quote | Get crypto pair quote |
| TradingApi | GetOptionImpact | POST /accounts/{accountId}/trading/options/impact | Get option order impact |
| TradingApi | GetOrderImpact | POST /trade/impact | Check equity order impact |
| TradingApi | GetUserAccountQuotes | GET /accounts/{accountId}/quotes | Get equity symbol quotes |
| TradingApi | PlaceBracketOrder | POST /accounts/{accountId}/trading/bracket | Place bracket order |
| TradingApi | PlaceCryptoOrder | POST /accounts/{accountId}/trading/crypto | Place crypto order |
| TradingApi | PlaceForceOrder | POST /trade/place | Place equity order |
| TradingApi | PlaceMlegOrder | POST /accounts/{accountId}/trading/options | Place option order |
| TradingApi | PlaceOrder | POST /trade/{tradeId} | Place checked equity order |
| TradingApi | PreviewCryptoOrder | POST /accounts/{accountId}/trading/crypto/preview | Preview crypto order |
| TradingApi | ReplaceOrder | POST /accounts/{accountId}/trading/replace | Replace order |
| TradingApi | SearchCryptocurrencyPairInstruments | GET /accounts/{accountId}/trading/instruments/cryptocurrencyPairs | Get crypto pairs |
| TransactionsAndReportingApi | GetActivities | GET /activities | Get transaction history for a user |
| TransactionsAndReportingApi | GetReportingCustomRange | GET /performance/custom | Get performance information for a specific timeframe |
This C# package is automatically generated by Konfig