Documentation
¶
Overview ¶
Package cidirectinvesting is a small SDK for interacting with the API of CI Direct Investing
Index ¶
- Variables
- type Account
- type AccountDetailRequest
- type AccountDetailResponse
- type AssetClassAllocation
- type Client
- func (c *Client) AccountDetails(request AccountDetailRequest) (*AccountDetailResponse, error)
- func (c *Client) Dashboard(request DashboardRequest) (*DashboardResponse, error)
- func (c *Client) History(request HistoryRequest) (*HistoryResponse, error)
- func (c *Client) Login() (*SessionResponse, error)
- func (c *Client) Transactions(request TransactionRequest) (*TransactionResponse, error)
- type Currency
- type DashboardRequest
- type DashboardResponse
- type Filter
- type HistoryEntry
- type HistoryRequest
- type HistoryResponse
- type Options
- type Position
- type Range
- type SessionResponse
- type Transaction
- type TransactionRequest
- type TransactionResponse
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // APIEndpoint is the production API offered by CI Direct Investing APIEndpoint = "https://app.cidirectinvesting.com/api" // UserAgent is a nice gesture so that the CI Direct Investing folks know who's hitting their API UserAgent = "cidirectinvesting/go-v0" )
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { Id int `json:"id"` UserId int `json:"user_id"` AccountNumber string `json:"account_number"` Currency string `json:"currency"` Status int `json:"status"` Archived bool `json:"archived"` JoinedAccounts interface{} `json:"joined_accounts"` SupportsDeposits bool `json:"supports_deposits"` SupportsWithdrawals bool `json:"supports_withdrawals"` MaskedAccountNumber string `json:"masked_account_number"` Name string `json:"name"` DefaultName string `json:"default_name"` AccountName string `json:"account_name"` AccountType string `json:"account_type"` AccountTypeFriendly string `json:"account_type_friendly"` CustodianName string `json:"custodian_name"` Custodian string `json:"custodian"` CustodianAlias string `json:"custodian_alias"` CustodianId int `json:"custodian_id"` ClientName string `json:"client_name"` PortfolioModelName string `json:"portfolio_model_name"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` InceptionDate string `json:"inception_date"` EndingBalanceDate string `json:"ending_balance_date"` BeginningBalanceDate string `json:"beginning_balance_date"` NetContributions float64 `json:"net_contributions"` TotalContributions float64 `json:"total_contributions"` Fees float64 `json:"fees"` TotalWithdrawals float64 `json:"total_withdrawals"` Withdrawals float64 `json:"withdrawals"` Deposits float64 `json:"deposits"` BeginningBalance float64 `json:"beginning_balance"` StartingBalance float64 `json:"starting_balance"` InitialValue float64 `json:"initial_value"` Balance float64 `json:"balance"` EndingBalance float64 `json:"ending_balance"` TotalValue float64 `json:"total_value"` MarketValue float64 `json:"market_value"` MarketValueEndingBalance float64 `json:"market_value_ending_balance"` MarketValueBeginningBalance float64 `json:"market_value_beginning_balance"` CashValue float64 `json:"cash_value"` CashValueEndingBalance float64 `json:"cash_value_ending_balance"` CashValueBeginningBalance float64 `json:"cash_value_beginning_balance"` WithdrawalsValue float64 `json:"withdrawals_value"` TradingBalance float64 `json:"trading_balance"` Gains float64 `json:"gains"` RateOfReturn float64 `json:"rate_of_return"` AnnualizedXirr float64 `json:"annualized_xirr"` }
type AccountDetailRequest ¶
type AccountDetailRequest struct {
AccountID int
}
type AccountDetailResponse ¶
type AccountDetailResponse struct { User User `json:"user"` Id int `json:"id"` UserId int `json:"user_id"` AccountNumber string `json:"account_number"` Currency string `json:"currency"` Status int `json:"status"` Archived bool `json:"archived"` JoinedAccounts interface{} `json:"joined_accounts"` SupportsDeposits bool `json:"supports_deposits"` SupportsWithdrawals bool `json:"supports_withdrawals"` MaskedAccountNumber string `json:"masked_account_number"` Name string `json:"name"` DefaultName string `json:"default_name"` AccountName string `json:"account_name"` AccountType string `json:"account_type"` AccountTypeFriendly string `json:"account_type_friendly"` CustodianName string `json:"custodian_name"` Custodian string `json:"custodian"` CustodianAlias string `json:"custodian_alias"` CustodianId int `json:"custodian_id"` ClientName string `json:"client_name"` PortfolioModelName string `json:"portfolio_model_name"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` InceptionDate string `json:"inception_date"` EndingBalanceDate string `json:"ending_balance_date"` BeginningBalanceDate string `json:"beginning_balance_date"` NetContributions float64 `json:"net_contributions"` TotalContributions float64 `json:"total_contributions"` Fees float64 `json:"fees"` TotalWithdrawals float64 `json:"total_withdrawals"` Withdrawals float64 `json:"withdrawals"` Deposits float64 `json:"deposits"` BeginningBalance float64 `json:"beginning_balance"` StartingBalance float64 `json:"starting_balance"` InitialValue float64 `json:"initial_value"` Balance float64 `json:"balance"` EndingBalance float64 `json:"ending_balance"` TotalValue float64 `json:"total_value"` MarketValue float64 `json:"market_value"` MarketValueEndingBalance float64 `json:"market_value_ending_balance"` MarketValueBeginningBalance float64 `json:"market_value_beginning_balance"` CashValue float64 `json:"cash_value"` CashValueEndingBalance float64 `json:"cash_value_ending_balance"` CashValueBeginningBalance float64 `json:"cash_value_beginning_balance"` WithdrawalsValue float64 `json:"withdrawals_value"` TradingBalance float64 `json:"trading_balance"` Gains float64 `json:"gains"` RateOfReturn float64 `json:"rate_of_return"` AssetClassAllocation []AssetClassAllocation `json:"asset_class_allocation"` Positions []Position `json:"positions"` Mer float64 `json:"mer"` FundedStatus string `json:"funded_status"` }
type AssetClassAllocation ¶
type Client ¶
type Client struct { APIEndpoint string // contains filtered or unexported fields }
Client holds the required state to perform API calls with the CI Direct Investing API
func (*Client) AccountDetails ¶
func (c *Client) AccountDetails(request AccountDetailRequest) (*AccountDetailResponse, error)
func (*Client) Dashboard ¶
func (c *Client) Dashboard(request DashboardRequest) (*DashboardResponse, error)
func (*Client) History ¶
func (c *Client) History(request HistoryRequest) (*HistoryResponse, error)
func (*Client) Login ¶
func (c *Client) Login() (*SessionResponse, error)
func (*Client) Transactions ¶
func (c *Client) Transactions(request TransactionRequest) (*TransactionResponse, error)
type DashboardRequest ¶
type DashboardResponse ¶
type DashboardResponse struct { BeginningBalance float64 `json:"beginning_balance"` EndingBalance float64 `json:"ending_balance"` Balance float64 `json:"balance"` EndingBalanceDate string `json:"ending_balance_date"` RateOfReturn float64 `json:"rate_of_return"` InceptionDate string `json:"inception_date"` Deposits float64 `json:"deposits"` Withdrawals float64 `json:"withdrawals"` NetContributions float64 `json:"net_contributions"` Gains float64 `json:"gains"` Fees float64 `json:"fees"` Accounts []Account `json:"accounts"` CanCreateHisa struct { Message string `json:"message"` } `json:"can_create_hisa"` User User `json:"user"` TaskReminders []interface{} `json:"task_reminders"` }
type Filter ¶
type Filter struct { Quantity *Range `json:"quantity"` Price *Range `json:"price"` Value *Range `json:"value"` Symbol *string `json:"symbol,omitempty"` // ie VSB Description *string `json:"description,omitempty"` Transactions []string `json:"transaction,omitempty"` // Adjustment, Buy, Cancel Buy, Cancel Sell, Cancel transfer, Deposit, Dividend, Fees, Interest, Other, Reorganization, Sell, Tax, Transfer, Withdrawal, Withholding }
type HistoryEntry ¶
type HistoryEntry struct { Date string `json:"date"` Total float64 `json:"total"` Accounts map[int]float64 `json:"-"` }
func (*HistoryEntry) UnmarshalJSON ¶
func (e *HistoryEntry) UnmarshalJSON(data []byte) error
type HistoryRequest ¶
type HistoryResponse ¶
type HistoryResponse []HistoryEntry
type Options ¶
Options allow the configuration of an API Client
func WithAPIEndpoint ¶
WithAPIEndpoint sets the APIEndpoint to be used. By default the real production endpoint is used
func WithThirdPartyKey ¶
WithThirdPartyKey sets the required authentication parameters
type Position ¶
type Position struct { InvestmentAccountId int `json:"investment_account_id"` InsertDate string `json:"insert_date"` CurrencyCode string `json:"currency_code"` Symbol string `json:"symbol"` Cusip *string `json:"cusip"` SecurityType string `json:"security_type"` ExchangeRate float64 `json:"exchange_rate"` PriceCad float64 `json:"price_cad"` Quantity float64 `json:"quantity"` Value float64 `json:"value"` ValueCad float64 `json:"value_cad"` Description string `json:"description"` Mer float64 `json:"mer"` AssetClass string `json:"asset_class"` Allocation float64 `json:"allocation"` FundsUrl string `json:"funds_url"` }
type SessionResponse ¶
type SessionResponse struct { Id int `json:"id"` Email string `json:"email"` Name string `json:"name"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Roles []string `json:"roles"` IntercomUserHash string `json:"intercom_user_hash"` Archived bool `json:"archived"` AdvisoryFee float64 `json:"advisory_fee"` Preferences struct { Dashboard struct { ChartRange string `json:"chart_range"` } `json:"dashboard"` } `json:"preferences"` HasAccounts struct { Id int `json:"id"` UserId int `json:"user_id"` Properties struct { Balance float64 `json:"balance"` ClientName string `json:"client_name"` } `json:"properties"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Status string `json:"status"` Payment interface{} `json:"payment"` LastBalanced interface{} `json:"last_balanced"` Archived bool `json:"archived"` Currency string `json:"currency"` AccountType string `json:"account_type"` EtfReady bool `json:"etf_ready"` CustodianAccountType string `json:"custodian_account_type"` PortfolioModelId interface{} `json:"portfolio_model_id"` DoNotTrade bool `json:"do_not_trade"` DoNotTradeReason interface{} `json:"do_not_trade_reason"` DoNotTradeChangedBy interface{} `json:"do_not_trade_changed_by"` DoNotTradeChangedAt interface{} `json:"do_not_trade_changed_at"` AutomateProfileChanges bool `json:"automate_profile_changes"` TransferOut interface{} `json:"transfer_out"` TransferOutChangedBy interface{} `json:"transfer_out_changed_by"` TransferOutChangedAt interface{} `json:"transfer_out_changed_at"` } `json:"has_accounts"` HasActiveAccounts bool `json:"has_active_accounts"` HasTransfers bool `json:"has_transfers"` HasActiveTransfers bool `json:"has_active_transfers"` HasPlans bool `json:"has_plans"` HasApplication bool `json:"has_application"` IsArchivable bool `json:"is_archivable"` EmailConfirmed bool `json:"email_confirmed"` HasExternalAdvisor bool `json:"has_external_advisor"` HideBeneficiaryDesignation bool `json:"hide_beneficiary_designation"` TwoFactorEnabled bool `json:"two_factor_enabled"` PromptTwoFactorSignup bool `json:"prompt_two_factor_signup"` Language string `json:"language"` IntercomUserHashIos string `json:"intercom_user_hash_ios"` IntercomUserHashAndroid string `json:"intercom_user_hash_android"` }
type Transaction ¶
type Transaction struct { Id int `json:"id"` ProcessDate string `json:"process_date"` AccountIdentifier string `json:"account_identifier"` TransactionId string `json:"transaction_id"` SubTransactionId string `json:"sub_transaction_id"` Commission string `json:"commission"` SecurityType string `json:"security_type"` ExchangeRate string `json:"exchange_rate"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` TransferId interface{} `json:"transfer_id"` EffectiveDate string `json:"effective_date"` TransactionDesc string `json:"transaction_desc"` TransactionType string `json:"transaction_type"` HumanTransactionType string `json:"human_transaction_type"` Quantity string `json:"quantity"` Price string `json:"price"` PriceCad string `json:"price_cad"` Value string `json:"value"` ValueCad string `json:"value_cad"` HoldingListed bool `json:"holding_listed"` HasMatchedTransfer bool `json:"has_matched_transfer"` CurrencyCode string `json:"currency_code"` Symbol *string `json:"symbol"` Cusip *string `json:"cusip"` FullCount int `json:"full_count"` FundsUrl string `json:"funds_url,omitempty"` }
type TransactionRequest ¶
type TransactionResponse ¶
type TransactionResponse struct { Metadata struct { TransactionTypes []struct { Category *string `json:"category"` } `json:"transaction_types"` User struct { Id int `json:"id"` Name string `json:"name"` } `json:"user"` InvestmentAccount struct { Id int `json:"id"` Name string `json:"name"` InceptionDate string `json:"inception_date"` } `json:"investment_account"` } `json:"metadata"` TotalCount int `json:"total_count"` TotalPages int `json:"total_pages"` Page int `json:"page"` Limit int `json:"limit"` Pagination struct { Next int `json:"next"` PageAfterNext interface{} `json:"page_after_next"` Previous interface{} `json:"previous"` PageBeforePrevious interface{} `json:"page_before_previous"` } `json:"pagination"` Data []Transaction `json:"data"` }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.