SnapTrade.Net
3.33.2
dotnet add package SnapTrade.Net --version 3.33.2
NuGet\Install-Package SnapTrade.Net -Version 3.33.2
<PackageReference Include="SnapTrade.Net" Version="3.33.2" />
paket add SnapTrade.Net --version 3.33.2
#r "nuget: SnapTrade.Net, 3.33.2"
// Install SnapTrade.Net as a Cake Addin
#addin nuget:?package=SnapTrade.Net&version=3.33.2
// Install SnapTrade.Net as a Cake Tool
#tool nuget:?package=SnapTrade.Net&version=3.33.2
SnapTrade.Net - the C# library for the SnapTrade
Connect brokerage accounts to your app for live positions and trading
This C# SDK is automatically generated by the Konfig:
- API version: 1.0.0
- SDK version: 3.33.2 For more information, please visit https://snaptrade.com/
Frameworks supported
- .NET Core >=1.0
- .NET Framework >=4.6
- Mono/Xamarin >=vNext
Dependencies
- RestSharp - 106.13.0 or later
- Json.NET - 13.0.1 or later
- JsonSubTypes - 1.8.0 or later
- System.ComponentModel.Annotations - 5.0.0 or later
The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:
Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes
Install-Package System.ComponentModel.Annotations
NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742. NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See RestSharp#1406.
Installation
Generate the DLL using your preferred tool (e.g. dotnet build
)
Then include the DLL (under the bin
folder) in the C# project, and use the namespaces:
using SnapTrade.Net.Api;
using SnapTrade.Net.Client;
using SnapTrade.Net.Model;
Getting Started
using System;
using System.Collections.Generic;
using System.Diagnostics;
using SnapTrade.Net.Client;
using SnapTrade.Net.Model;
namespace Example
{
public class GetAllUserHoldingsExample
{
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 userId = "userId_example"; // string |
var userSecret = "userSecret_example"; // string |
var brokerageAuthorizations = 917c8734-8470-4a3e-a18f-57c3f2ee6631; // Guid? | Optional. Comma seperated list of authorization IDs (only use if filtering is needed on one or more authorizations). (optional)
try
{
// List all accounts for the user, plus balances, positions, and orders for each account.
List<AccountHoldings> result = client.AccountInformation.GetAllUserHoldings(userId, userSecret, brokerageAuthorizations);
Console.WriteLine(result);
}
catch (ApiException e)
{
Console.WriteLine("Exception when calling AccountInformationApi.GetAllUserHoldings: " + 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);
}
}
}
}
Documentation for API Endpoints
All URIs are relative to https://api.snaptrade.com/api/v1
Class | Method | HTTP request | Description |
---|---|---|---|
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} | Return details of a specific investment account |
AccountInformationApi | GetUserAccountOrders | GET /accounts/{accountId}/orders | Get history of orders placed in account |
AccountInformationApi | GetUserAccountPositions | GET /accounts/{accountId}/positions | List account positions |
AccountInformationApi | GetUserHoldings | GET /accounts/{accountId}/holdings | List balances, positions and orders for the specified account. |
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 SnapTrade user |
AuthenticationApi | GetUserJWT | GET /snapTrade/encryptedJWT | Generate encrypted JWT token |
AuthenticationApi | ListSnapTradeUsers | GET /snapTrade/listUsers | List SnapTrade users |
AuthenticationApi | LoginSnapTradeUser | POST /snapTrade/login | Login user & generate connection link |
AuthenticationApi | RegisterSnapTradeUser | POST /snapTrade/registerUser | Create SnapTrade user |
ConnectionsApi | DetailBrokerageAuthorization | GET /authorizations/{authorizationId} | Get brokerage authorization details |
ConnectionsApi | ListBrokerageAuthorizations | GET /authorizations | List all brokerage authorizations for the user |
ConnectionsApi | RemoveBrokerageAuthorization | DELETE /authorizations/{authorizationId} | Delete brokerage authorization |
ConnectionsApi | SessionEvents | GET /sessionEvents | List all session events for the partner |
ErrorLogsApi | ListUserErrors | GET /snapTrade/listUserErrors | Retrieve error logs on behalf of your SnapTrade users |
OptionsApi | GetOptionStrategy | POST /accounts/{accountId}/optionStrategy | Creates an option strategy object that will be used to place an option strategy order |
OptionsApi | GetOptionsChain | GET /accounts/{accountId}/optionsChain | Get the options chain |
OptionsApi | GetOptionsStrategyQuote | GET /accounts/{accountId}/optionStrategy/{optionStrategyId} | Get latest market data of option strategy |
OptionsApi | ListOptionHoldings | GET /accounts/{accountId}/options | Get the options holdings in the account |
OptionsApi | PlaceOptionStrategy | POST /accounts/{accountId}/optionStrategy/{optionStrategyId}/execute | Place an option strategy order on the brokerage |
ReferenceDataApi | GetCurrencyExchangeRatePair | GET /currencies/rates/{currencyPair} | Return the exchange rate of a currency pair |
ReferenceDataApi | GetPartnerInfo | GET /snapTrade/partners | Get metadata related to Snaptrade partner |
ReferenceDataApi | GetSecurityTypes | GET /securityTypes | List of all security types. |
ReferenceDataApi | GetStockExchanges | GET /exchanges | List exchanges |
ReferenceDataApi | GetSymbols | POST /symbols | Search for symbols |
ReferenceDataApi | GetSymbolsByTicker | GET /symbols/{ticker} | Get details of a symbol by the ticker |
ReferenceDataApi | ListAllBrokerageAuthorizationType | GET /brokerageAuthorizationTypes | List of all brokerage authorization types |
ReferenceDataApi | ListAllBrokerages | GET /brokerages | List brokerages |
ReferenceDataApi | ListAllCurrencies | GET /currencies | List currencies |
ReferenceDataApi | ListAllCurrenciesRates | GET /currencies/rates | List currency exchange rates |
ReferenceDataApi | SymbolSearchUserAccount | POST /accounts/{accountId}/symbols | Search for symbols available in an account |
TradingApi | CancelUserAccountOrder | POST /accounts/{accountId}/orders/cancel | Cancel open order in account |
TradingApi | GetOrderImpact | POST /trade/impact | Check impact of trades on account. |
TradingApi | GetUserAccountQuotes | GET /accounts/{accountId}/quotes | Get symbol quotes |
TradingApi | PlaceForceOrder | POST /trade/place | Place a trade with NO validation. |
TradingApi | PlaceOCOOrder | POST /trade/oco | Place a OCO (One Cancels Other) order |
TradingApi | PlaceOrder | POST /trade/{tradeId} | Place order |
TransactionsAndReportingApi | GetActivities | GET /activities | Get transaction history for a user |
TransactionsAndReportingApi | GetReportingCustomRange | GET /performance/custom | Get performance information for a specific timeframe |
Documentation for Models
- Model.Account
- Model.AccountHoldings
- Model.AccountHoldingsAccount
- Model.AccountOrderRecord
- Model.AccountOrderRecordStatus
- Model.AccountSimple
- Model.AccountSyncStatus
- Model.Action
- Model.AuthenticationLoginSnapTradeUser200Response
- Model.Balance
- Model.Brokerage
- Model.BrokerageAuthorization
- Model.BrokerageAuthorizationType
- Model.BrokerageAuthorizationTypeReadOnly
- Model.BrokerageAuthorizationTypeReadOnlyBrokerage
- Model.BrokerageSymbol
- Model.BrokerageSymbolOptionSymbol
- Model.BrokerageSymbolSymbol
- Model.BrokerageType
- Model.CalculatedTrade
- Model.CashRestriction
- Model.ConnectionsSessionEvents200ResponseInner
- Model.Currency
- Model.DeleteUserResponse
- Model.DividendAtDate
- Model.EncryptedResponse
- Model.EncryptedResponseEncryptedMessageData
- Model.Exchange
- Model.ExchangeRatePairs
- Model.ExcludedAsset
- Model.JWT
- Model.LoginRedirectURI
- Model.ManualTrade
- Model.ManualTradeAndImpact
- Model.ManualTradeBalance
- Model.ManualTradeForm
- Model.ManualTradeSymbol
- Model.Model400FailedRequestResponse
- Model.Model401FailedRequestResponse
- Model.Model403FailedRequestResponse
- Model.Model404FailedRequestResponse
- Model.ModelAssetClass
- Model.ModelAssetClassDetails
- Model.ModelAssetClassTarget
- Model.ModelPortfolio
- Model.ModelPortfolioAssetClass
- Model.ModelPortfolioDetails
- Model.ModelPortfolioSecurity
- Model.MonthlyDividends
- Model.NetContributions
- Model.NetDividend
- Model.OptionChainInner
- Model.OptionChainInnerChainPerRootInner
- Model.OptionChainInnerChainPerRootInnerChainPerStrikePriceInner
- Model.OptionLeg
- Model.OptionStrategy
- Model.OptionStrategyLegsInner
- Model.OptionsGetOptionStrategyRequest
- Model.OptionsHoldings
- Model.OptionsPlaceOptionStrategyRequest
- Model.OptionsPosition
- Model.OptionsPositionCurrency
- Model.OptionsSymbol
- Model.OrderType
- Model.PartnerData
- Model.PastValue
- Model.PerformanceCustom
- Model.PortfolioGroup
- Model.PortfolioGroupInfo
- Model.PortfolioGroupPosition
- Model.PortfolioGroupSettings
- Model.Position
- Model.PositionSymbol
- Model.RedirectTokenandPin
- Model.SecurityType
- Model.SessionEvent
- Model.SnapTradeAPIDisclaimerAcceptStatus
- Model.SnapTradeHoldingsAccount
- Model.SnapTradeHoldingsAccountAccountId
- Model.SnapTradeHoldingsTotalValue
- Model.SnapTradeLoginUserRequestBody
- Model.SnapTradeRegisterUserRequestBody
- Model.Status
- Model.StrategyImpact
- Model.StrategyImpactLegsInner
- Model.StrategyOrderPlace
- Model.StrategyOrderPlaceOrdersInner
- Model.StrategyOrderPlaceOrdersInnerLegsInner
- Model.StrategyOrderRecord
- Model.StrategyQuotes
- Model.StrategyQuotesGreek
- Model.SubPeriodReturnRate
- Model.Symbol
- Model.SymbolQuery
- Model.SymbolsQuotesInner
- Model.TargetAsset
- Model.TimeInForce
- Model.Trade
- Model.TradeExecutionStatus
- Model.TradeImpact
- Model.TradingCancelUserAccountOrderRequest
- Model.TradingPlaceOCOOrderRequest
- Model.TransactionsStatus
- Model.USExchange
- Model.UnderlyingSymbol
- Model.UniversalActivity
- Model.UniversalSymbol
- Model.UniversalSymbolTicker
- Model.UserErrorLog
- Model.UserIDandSecret
- Model.UserSettings
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. 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 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- JsonSubTypes (>= 1.9.0)
- Newtonsoft.Json (>= 13.0.1)
- Polly (>= 7.2.3)
- RestSharp (>= 108.0.2)
- System.ComponentModel.Annotations (>= 5.0.0)
-
net5.0
- JsonSubTypes (>= 1.9.0)
- Newtonsoft.Json (>= 13.0.1)
- Polly (>= 7.2.3)
- RestSharp (>= 108.0.2)
- System.ComponentModel.Annotations (>= 5.0.0)
-
net7.0
- JsonSubTypes (>= 1.9.0)
- Newtonsoft.Json (>= 13.0.1)
- Polly (>= 7.2.3)
- RestSharp (>= 108.0.2)
- System.ComponentModel.Annotations (>= 5.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.
Version | Downloads | Last updated |
---|---|---|
3.33.2 | 74 | 9/26/2023 |
3.33.1 | 89 | 9/19/2023 |
3.33.0 | 114 | 9/2/2023 |
3.32.1 | 103 | 8/31/2023 |
3.32.0 | 101 | 8/16/2023 |
3.31.0 | 90 | 8/14/2023 |
3.30.0 | 140 | 8/11/2023 |
3.29.0 | 117 | 8/9/2023 |
3.28.0 | 108 | 8/9/2023 |
3.27.0 | 120 | 8/4/2023 |
3.26.0 | 119 | 8/2/2023 |
3.25.0 | 128 | 7/31/2023 |
3.24.0 | 119 | 7/27/2023 |
3.23.0 | 116 | 7/27/2023 |
3.22.0 | 119 | 7/18/2023 |
3.21.0 | 125 | 6/22/2023 |
3.20.0 | 111 | 6/13/2023 |
3.19.0 | 131 | 6/7/2023 |
3.18.0 | 136 | 6/5/2023 |
3.17.0 | 184 | 6/1/2023 |
3.15.0 | 118 | 5/29/2023 |
3.14.0 | 110 | 5/26/2023 |
3.13.0 | 2,125 | 5/18/2023 |
3.12.0 | 110 | 5/16/2023 |
3.11.0 | 98 | 5/15/2023 |
3.10.0 | 124 | 5/9/2023 |
3.9.0 | 414 | 4/28/2023 |
3.8.0 | 144 | 4/28/2023 |
3.7.0 | 309 | 4/23/2023 |
3.6.0 | 141 | 4/21/2023 |
3.5.0 | 148 | 4/20/2023 |
3.4.0 | 144 | 4/18/2023 |
3.3.0 | 139 | 4/17/2023 |
3.2.0 | 173 | 4/15/2023 |
3.1.0 | 151 | 4/15/2023 |
3.0.0 | 150 | 4/12/2023 |
2.0.0 | 172 | 4/11/2023 |
1.3.0 | 177 | 4/6/2023 |
1.2.0 | 153 | 4/6/2023 |
1.1.0 | 177 | 4/6/2023 |
1.0.0 | 174 | 4/6/2023 |
Minor update