Documentation ¶
Index ¶
- Constants
- type AccessToken
- type Account
- type AccountBalance
- type AccountBalances
- type AccountTransaction
- type AccountTransactions
- type AccountType
- type AmountValue
- type AuthOptions
- type Authentication
- type Authenticator
- type Client
- func (c *Client) Authenticate(ctx context.Context) (*Authentication, error)
- func (c *Client) Balance(ctx context.Context, accountId string) (*AccountBalance, error)
- func (c *Client) Balances(ctx context.Context) (*AccountBalances, error)
- func (c *Client) CreateOrder(order OrderRequest, tan string)
- func (c *Client) CreateQuoteOrder()
- func (c *Client) CreateQuoteRequest()
- func (c *Client) CreateQuoteTicket()
- func (c *Client) DeleteOrder(orderID string, tan string)
- func (c *Client) DepotPosition(depotID string, positionID string, options ...Options) (*DepotPosition, error)
- func (c *Client) DepotPositions(depotID string, options ...Options) (*DepotPositions, error)
- func (c *Client) DepotTransactions(depotID string, options ...Options) (*DepotTransactions, error)
- func (c *Client) Depots() (*Depots, error)
- func (c *Client) Dimensions() ([]Dimension, error)
- func (c *Client) Documents(ctx context.Context, options ...Options) (*Documents, error)
- func (c *Client) DownloadDocument(ctx context.Context, document *Document, folder string) error
- func (c *Client) ExAnteOrder()
- func (c *Client) GetAuthentication() *Authentication
- func (c *Client) Instrument(instrument string) ([]Instrument, error)
- func (c *Client) Order(orderID string)
- func (c *Client) Orders(depotID string)
- func (c *Client) PreValidateOrder()
- func (c *Client) Refresh() (*Authentication, error)
- func (c *Client) Reports(ctx context.Context, options ...Options) (*Reports, error)
- func (c *Client) Revoke() error
- func (c *Client) SetAuthentication(auth *Authentication) error
- func (c *Client) Transactions(ctx context.Context, accountId string, options ...Options) (*AccountTransactions, error)
- func (c *Client) UpdateOrder(orderID string, tan string)
- func (c *Client) UpdateQuoteTicket(quoteTicketID string)
- func (c *Client) ValidateOrder()
- func (c *Client) ValidateOrderDeletion(orderID string)
- func (c *Client) ValidateOrderUpdate(order OrderRequest)
- func (c *Client) ValidateQuoteOrder()
- type Creditor
- type Depot
- type DepotAggregated
- type DepotPosition
- type DepotPositions
- type DepotTransaction
- type DepotTransactions
- type Depots
- type Dimension
- type Dimensions
- type Document
- type DocumentMetaData
- type Documents
- type HTTPClient
- type Instrument
- type Instruments
- type Options
- type OrderRequest
- type OrderType
- type OrderTypes
- type Paging
- type Price
- type Remitter
- type Report
- type ReportAggregated
- type ReportBalance
- type Reports
- type StaticData
- type TransactionType
- type Values
- type Venue
Constants ¶
const ( HttpRequestInfoHeaderKey = "X-Http-Request-Info" OnceAuthenticationInfoHeaderKey = "X-Once-Authentication-Info" OnceAuthenticationHeaderKey = "X-Once-Authentication" AuthorizationHeaderKey = "Authorization" ContentTypeHeaderKey = "Content-Type" AcceptHeaderKey = "Accept" Host = "api.comdirect.de" ApiPath = "/api" OAuthTokenPath = "/oauth/token" PasswordGrantType = "password" SecondaryGrantType = "cd_secondary" RefreshTokenGrantType = "refresh_token" DefaultHttpTimeout = time.Second * 30 HttpsScheme = "https" BearerPrefix = "Bearer " PagingFirstQueryKey = "paging-first" PagingCountQueryKey = "paging-count" ProductTypeQueryKey = "productType" TargetClientIDQueryKey = "targetClientId" WithoutAttrQueryKey = "without-attr" WithAttrQueryKey = "with-attr" ClientConnectionTypeQueryKey = "clientConnectionType" OrderStatusQueryKey = "orderStatus" VenueIDQueryKey = "venueId" SideQueryKey = "side" OrderTypeQueryKey = "orderType" InstrumentIDQueryKey = "instrumentId" WKNQueryKey = "wkn" ISINQueryKey = "isin" TypeQueryKey = "type" BookingStatusQueryKey = "bookingStatus" MaxBookingDateQueryKey = "max-bookingDate" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessToken ¶
type AccessToken struct { AccessToken string `json:"access_token"` TokenType string `json:"token_type"` RefreshToken string `json:"refresh_token"` ExpiresIn int `json:"expires_in"` Scope string `json:"scope"` CustomerID string `json:"kdnr"` BPID int `json:"bpid"` ContactID int `json:"kontaktId"` }
AccessToken represents an OAuth2 token that is returned from the comdirect REST API.
type Account ¶
type Account struct { AccountID string `json:"accountId"` AccountDisplayID string `json:"accountDisplayId"` Currency string `json:"currency"` ClientID string `json:"clientId"` AccountType AccountType `json:"accountType"` Iban string `json:"iban"` CreditLimit AmountValue `json:"creditLimit"` }
type AccountBalance ¶
type AccountBalance struct { Account Account `json:"account"` AccountId string `json:"accountId"` Balance AmountValue `json:"balance"` BalanceEUR AmountValue `json:"balanceEUR"` AvailableCashAmount AmountValue `json:"availableCashAmount"` AvailableCashAmountEUR AmountValue `json:"availableCashAmountEUR"` }
type AccountBalances ¶
type AccountBalances struct { Paging Paging `json:"paging"` Values []AccountBalance `json:"values"` }
type AccountTransaction ¶
type AccountTransaction struct { Reference string `json:"reference"` BookingStatus string `json:"bookingStatus"` BookingDate string `json:"bookingDate"` Amount AmountValue `json:"amount"` Remitter Remitter `json:"remitter"` Deptor string `json:"deptor"` Creditor Creditor `json:"creditor"` ValutaDate string `json:"valutaDate"` DirectDebitCreditorID string `json:"directDebitCreditorId"` DirectDebitMandateID string `json:"directDebitMandateId"` EndToEndReference string `json:"endToEndReference"` NewTransaction bool `json:"newTransaction"` RemittanceInfo string `json:"remittanceInfo"` TransactionType TransactionType `json:"transactionType"` }
type AccountTransactions ¶
type AccountTransactions struct { Paging Paging `json:"paging"` Values []AccountTransaction `json:"values"` }
type AccountType ¶
type AmountValue ¶
type AuthOptions ¶
AuthOptions encapsulates the information for authentication against the comdirect REST API.
type Authentication ¶
type Authentication struct {
// contains filtered or unexported fields
}
Authentication represents an authentication object for the comdirect REST API.
func NewAuthentication ¶
func NewAuthentication(accessToken AccessToken, sessionID string, time time.Time) *Authentication
func (*Authentication) AccessToken ¶
func (a *Authentication) AccessToken() AccessToken
func (*Authentication) ExpiryTime ¶
func (a *Authentication) ExpiryTime() time.Time
func (*Authentication) IsExpired ¶
func (a *Authentication) IsExpired() bool
func (*Authentication) SessionID ¶
func (a *Authentication) SessionID() string
type Authenticator ¶
type Authenticator struct {
// contains filtered or unexported fields
}
Authenticator is responsible for authenticating against the comdirect REST API. It uses the given AuthOptions for authentication and returns an AccessToken in case the authentication flow was successful. Authenticator is using golang's default http.Client.
func NewAuthenticator ¶
func NewAuthenticator(options *AuthOptions) *Authenticator
NewAuthenticator creates a new Authenticator by passing AuthOptions and an http.Client with a timeout of DefaultHttpTimeout.
func (*Authenticator) Authenticate ¶
func (a *Authenticator) Authenticate(ctx context.Context) (*Authentication, error)
Authenticate authenticates against the comdirect REST API.
func (*Authenticator) Refresh ¶
func (a *Authenticator) Refresh(auth Authentication) (Authentication, error)
func (*Authenticator) Revoke ¶
func (a *Authenticator) Revoke(auth Authentication) error
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewWithAuthOptions ¶
func NewWithAuthOptions(options *AuthOptions) *Client
NewWithAuthOptions creates a new Client with given AuthOptions
func NewWithAuthentication ¶
func NewWithAuthentication(authentication *Authentication) *Client
func NewWithAuthenticator ¶
func NewWithAuthenticator(authenticator *Authenticator) *Client
NewWithAuthenticator creates a new Client with a given Authenticator
func (*Client) Authenticate ¶
func (c *Client) Authenticate(ctx context.Context) (*Authentication, error)
Authenticate uses the underlying Authenticator to authenticate against the comdirect REST API.
func (*Client) CreateOrder ¶
func (c *Client) CreateOrder(order OrderRequest, tan string)
func (*Client) CreateQuoteOrder ¶
func (c *Client) CreateQuoteOrder()
func (*Client) CreateQuoteRequest ¶
func (c *Client) CreateQuoteRequest()
func (*Client) CreateQuoteTicket ¶
func (c *Client) CreateQuoteTicket()
func (*Client) DeleteOrder ¶
func (*Client) DepotPosition ¶
func (c *Client) DepotPosition(depotID string, positionID string, options ...Options) (*DepotPosition, error)
DepotPosition retrieves a position by its ID from the depot specified by its ID.
func (*Client) DepotPositions ¶
func (c *Client) DepotPositions(depotID string, options ...Options) (*DepotPositions, error)
DepotPositions retrieves all positions for a specific depot ID.
func (*Client) DepotTransactions ¶
func (c *Client) DepotTransactions(depotID string, options ...Options) (*DepotTransactions, error)
DepotTransactions retrieves all transactions for a depot specified by its ID.
func (*Client) Dimensions ¶
func (*Client) DownloadDocument ¶
func (*Client) ExAnteOrder ¶
func (c *Client) ExAnteOrder()
func (*Client) GetAuthentication ¶
func (c *Client) GetAuthentication() *Authentication
func (*Client) Instrument ¶
func (c *Client) Instrument(instrument string) ([]Instrument, error)
Instrument retrieves instrument information by WKN, ISIN or mnemonic
func (*Client) PreValidateOrder ¶
func (c *Client) PreValidateOrder()
func (*Client) Refresh ¶
func (c *Client) Refresh() (*Authentication, error)
Refresh uses the underlying Authenticator to refresh an access token.
func (*Client) SetAuthentication ¶
func (c *Client) SetAuthentication(auth *Authentication) error
func (*Client) Transactions ¶
func (*Client) UpdateOrder ¶
func (*Client) UpdateQuoteTicket ¶
func (*Client) ValidateOrder ¶
func (c *Client) ValidateOrder()
func (*Client) ValidateOrderDeletion ¶
func (*Client) ValidateOrderUpdate ¶
func (c *Client) ValidateOrderUpdate(order OrderRequest)
func (*Client) ValidateQuoteOrder ¶
func (c *Client) ValidateQuoteOrder()
type Depot ¶
type Depot struct { DepotId string `json:"depotId"` DepotDisplayId string `json:"depotDisplayId"` ClientId string `json:"clientId"` DefaultSettlementAccountId string `json:"defaultSettlementAccountId"` SettlementAccountIds []string `json:"settlementAccountIds"` HolderName string `json:"holderName"` }
type DepotAggregated ¶
type DepotAggregated struct { Depot Depot `json:"depot"` PrevDayValue AmountValue `json:"prevDayValue"` CurrentValue AmountValue `json:"currentValue"` PurchaseValue AmountValue `json:"purchaseValue"` ProfitLossPurchaseAbs AmountValue `json:"ProfitLossPurchaseAbs"` ProfitLossPurchaseRel string `json:"profitLossPurchaseRel"` ProfitLossPrevDayAbs AmountValue `json:"profitLossPrevDayAbs"` ProfitLossPrevDayRel string `json:"profitLossPrevDayRel"` }
type DepotPosition ¶
type DepotPosition struct { DepotId string `json:"depotId"` PositionId string `json:"positionId"` Wkn string `json:"wkn"` CustodyType string `json:"custodyType"` Quantity AmountValue `json:"quantity"` AvailableQuantity AmountValue `json:"availableQuantity"` CurrentPrice Price `json:"currentPrice"` PrevDayPrice Price `json:"prevDayPrice"` CurrentValue AmountValue `json:"currentValue"` PurchaseValue AmountValue `json:"purchaseValue"` ProfitLossPurchaseAbs AmountValue `json:"profitLossPurchaseAbs"` ProfitLossPurchaseRel string `json:"profitLossPurchaseRel"` ProfitLossPrevDayAbs AmountValue `json:"profitLossPrevDayAbs"` ProfitLossPrevDayRel string `json:"profitLossPrevDayRel"` AvailableQuantityToHedge AmountValue `json:"availableQuantityToHedge"` }
type DepotPositions ¶
type DepotPositions struct { Paging Paging `json:"paging"` Aggregated DepotAggregated `json:"aggregated"` Values []DepotPosition `json:"values"` }
type DepotTransaction ¶
type DepotTransaction struct { TransactionID string `json:"transactionId"` Instrument Instrument `json:"instrument"` ExecutionPrice AmountValue `json:"executionPrice"` TransactionValue AmountValue `json:"transactionValue"` TransactionDirection string `json:"transactionDirection"` TransactionType string `json:"transactionType"` FXRate string `json:"fxRate"` }
type DepotTransactions ¶
type DepotTransactions struct { Paging Paging `json:"paging"` Values []DepotTransaction `json:"values"` }
type Dimensions ¶
type Dimensions struct {
Values []Dimension
}
type Document ¶
type Document struct { DocumentID string `json:"documentId"` Name string `json:"name"` DateCreation string `json:"dateCreation"` MimeType string `json:"mimeType"` Deletable bool `json:"deletable"` Advertisement bool `json:"advertisement"` DocumentMetaData DocumentMetaData `json:"documentMetaData"` }
type DocumentMetaData ¶
type HTTPClient ¶
type Instrument ¶
type Instruments ¶
type Instruments struct {
Values []Instrument `json:"values"`
}
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
func EmptyOptions ¶
func EmptyOptions() Options
func (*Options) WithValues ¶
type OrderRequest ¶
type OrderRequest struct { DepotID string `json:"depotId,omitempty"` OrderID string `json:"orderId,omitempty"` Side string `json:"side"` InstrumentID string `json:"instrumentId"` OrderType string `json:"orderType"` Quantity AmountValue `json:"quantity"` VenueID string `json:"venueId"` Limit AmountValue `json:"limit"` ValidityType string `json:"validityType"` Validity string `json:"validity"` }
type OrderTypes ¶
type OrderTypes struct { Quote OrderType `json:"QUOTE"` Market OrderType `json:"MARKET"` StopMarket OrderType `json:"STOP_MARKET"` NextOrder OrderType `json:"NEXT_ORDER"` OneCancelsOther OrderType `json:"ONE_CANCELS_ORDER"` Limit OrderType `json:"LIMIT"` TrailingStopMarket OrderType `json:"TRAILING_STOP_MARKET"` }
type Price ¶
type Price struct { Price AmountValue `json:"price"` PriceDateTime string `json:"priceDateTime"` }
type Report ¶
type Report struct { ProductID string `json:"productId"` ProductType string `json:"productType"` TargetClientID string `json:"targetClientId"` ClientConnectionType string `json:"clientConnectionType"` Balance ReportBalance `json:"balance"` }
type ReportAggregated ¶
type ReportAggregated struct { BalanceEUR AmountValue `json:"balanceEUR"` AvailableCashAmountEUR AmountValue `json:"availableCashAmountEUR"` }
type ReportBalance ¶
type ReportBalance struct { Account Account `json:"account"` AccountId string `json:"accountId"` Balance AmountValue `json:"balance"` BalanceEUR AmountValue `json:"balanceEUR"` AvailableCashAmount AmountValue `json:"availableCashAmount"` AvailableCashAmountEUR AmountValue `json:"availableCashAmountEUR"` Depot Depot `json:"depot"` DepotID string `json:"depotId"` DateLastUpdate string `json:"dateLastUpdate"` PrevDayValue AmountValue `json:"prevDayValue"` }
type Reports ¶
type Reports struct { Paging Paging `json:"paging"` ReportAggregated ReportAggregated `json:"Aggregated"` Values []Report `json:"values"` }
type StaticData ¶
type StaticData struct { Notation string `json:"notation"` Currency string `json:"currency"` InstrumentType string `json:"instrumentType"` PriipsRelevant bool `json:"priipsRelevant"` KidAvailable bool `json:"kidAvailable"` ShippingWaiverRequired bool `json:"shippingWaiverRequired"` FundRedemptionLimited bool `json:"fundRedemptionLimited"` }