Categorygithub.com/passiv/snaptrade-sdks/sdks/go
package
1.0.36
Repository: https://github.com/passiv/snaptrade-sdks.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

Visit SnapTrade

SnapTrade

Connect brokerage accounts to your app for live positions and trading

Go Reference More Info

Installation

Add to your project:

go get github.com/passiv/snaptrade-sdks/sdks/go

Getting Started

package main

import (
	"fmt"
	"os"

	snaptrade "github.com/passiv/snaptrade-sdks/sdks/go"
)

func main() {
	configuration := snaptrade.NewConfiguration()
	configuration.SetPartnerClientId(os.Getenv("SNAPTRADE_CLIENT_ID"))
	configuration.SetConsumerKey(os.Getenv("SNAPTRADE_CONSUMER_KEY"))
	client := snaptrade.NewAPIClient(configuration)

	// 1) Create a new user
	requestBody := snaptrade.NewSnapTradeRegisterUserRequestBody()
	userId := "USER_ID_FROM_YOU"
	requestBody.SetUserId(userId)
	request := client.AuthenticationApi.RegisterSnapTradeUser(*requestBody)
	resp, _, _ := request.Execute()

	// 2) Get user secret
	userSecret := resp.UserSecret

	// 3) Get redirect URI
	loginResp, _, _ := client.AuthenticationApi.LoginSnapTradeUser(userId, *userSecret).Execute()
	fmt.Println("Login redirect URI:", loginResp.LoginRedirectURI)

	// 4) Obtain account holdings data
	holdingsResp, _, _ := client.AccountInformationApi.GetAllUserHoldings(userId, *userSecret).Execute()
	fmt.Println("Account holdings:", holdingsResp)
	// 5) Delete the user
	deleteResp, _, _ := client.AuthenticationApi.DeleteSnapTradeUser(userId).Execute()
	fmt.Println("User deletion response:", deleteResp)
}

Documentation for API Endpoints

All URIs are relative to https://api.snaptrade.com/api/v1

ClassMethodHTTP requestDescription
AccountInformationApiGetAllUserHoldingsGet /holdingsList all accounts for the user, plus balances, positions, and orders for each account.
AccountInformationApiGetUserAccountBalanceGet /accounts/{accountId}/balancesList account balances
AccountInformationApiGetUserAccountDetailsGet /accounts/{accountId}Get account detail
AccountInformationApiGetUserAccountOrdersGet /accounts/{accountId}/ordersList account recent orders
AccountInformationApiGetUserAccountPositionsGet /accounts/{accountId}/positionsList account positions
AccountInformationApiGetUserAccountRecentOrdersGet /accounts/{accountId}/recentOrdersList account recent executed orders
AccountInformationApiGetUserAccountReturnRatesGet /accounts/{accountId}/returnRatesList account rate of returns
AccountInformationApiGetUserHoldingsGet /accounts/{accountId}/holdingsList account holdings
AccountInformationApiListUserAccountsGet /accountsList accounts
AccountInformationApiUpdateUserAccountPut /accounts/{accountId}Update details of an investment account
APIStatusApiCheckGet /Get API Status
AuthenticationApiDeleteSnapTradeUserDelete /snapTrade/deleteUserDelete user
AuthenticationApiListSnapTradeUsersGet /snapTrade/listUsersList all users
AuthenticationApiLoginSnapTradeUserPost /snapTrade/loginGenerate Connection Portal URL
AuthenticationApiRegisterSnapTradeUserPost /snapTrade/registerUserRegister user
AuthenticationApiResetSnapTradeUserSecretPost /snapTrade/resetUserSecretRotate user secret
ConnectionsApiDetailBrokerageAuthorizationGet /authorizations/{authorizationId}Get connection detail
ConnectionsApiDisableBrokerageAuthorizationPost /authorizations/{authorizationId}/disableForce disable connection
ConnectionsApiListBrokerageAuthorizationsGet /authorizationsList all connections
ConnectionsApiRefreshBrokerageAuthorizationPost /authorizations/{authorizationId}/refreshRefresh holdings for a connection
ConnectionsApiRemoveBrokerageAuthorizationDelete /authorizations/{authorizationId}Delete connection
ConnectionsApiReturnRatesGet /authorizations/{authorizationId}/returnRatesList connection rate of returns
ConnectionsApiSessionEventsGet /sessionEventsGet all session events for a user
OptionsApiGetOptionStrategyPost /accounts/{accountId}/optionStrategyCreate options strategy
OptionsApiGetOptionsChainGet /accounts/{accountId}/optionsChainGet the options chain for a symbol
OptionsApiGetOptionsStrategyQuoteGet /accounts/{accountId}/optionStrategy/{optionStrategyId}Get options strategy quotes
OptionsApiListOptionHoldingsGet /accounts/{accountId}/optionsList account option positions
OptionsApiPlaceOptionStrategyPost /accounts/{accountId}/optionStrategy/{optionStrategyId}/executePlace an option strategy order
ReferenceDataApiGetCurrencyExchangeRatePairGet /currencies/rates/{currencyPair}Get exchange rate of a currency pair
ReferenceDataApiGetPartnerInfoGet /snapTrade/partnersGet Client Info
ReferenceDataApiGetSecurityTypesGet /securityTypesList security types
ReferenceDataApiGetStockExchangesGet /exchangesGet exchanges
ReferenceDataApiGetSymbolsPost /symbolsSearch symbols
ReferenceDataApiGetSymbolsByTickerGet /symbols/{query}Get symbol detail
ReferenceDataApiListAllBrokerageAuthorizationTypeGet /brokerageAuthorizationTypesGet all brokerage authorization types
ReferenceDataApiListAllBrokeragesGet /brokeragesGet brokerages
ReferenceDataApiListAllCurrenciesGet /currenciesGet currencies
ReferenceDataApiListAllCurrenciesRatesGet /currencies/ratesGet currency exchange rates
ReferenceDataApiSymbolSearchUserAccountPost /accounts/{accountId}/symbolsSearch account symbols
TradingApiCancelUserAccountOrderPost /accounts/{accountId}/orders/cancelCancel order
TradingApiGetOrderImpactPost /trade/impactCheck order impact
TradingApiGetUserAccountQuotesGet /accounts/{accountId}/quotesGet symbol quotes
TradingApiPlaceForceOrderPost /trade/placePlace order
TradingApiPlaceOrderPost /trade/{tradeId}Place checked order
TransactionsAndReportingApiGetActivitiesGet /activitiesGet transaction history for a user
TransactionsAndReportingApiGetReportingCustomRangeGet /performance/customGet performance information for a specific timeframe

Documentation For Models