Liking cljdoc? Tell your friends :D

clj-tda.api

Functions to access the TD Ameritrade API.

Functions to access the TD Ameritrade API.
raw docstring

->comma-sep-strclj

(->comma-sep-str items)
source

->iso-dateclj

(->iso-date local-date)

Returns the local-date as a string in ISO_DATE format.

Returns the local-date as a string in ISO_DATE format.
sourceraw docstring

cancel-orderclj

(cancel-order access-token account-id order-id)

Cancels the order specified by order-id. Returns status 200 if successful and status 400 if order ID invalid. Note that API page says it should return 404 if the order is not found. This doesn't seem to happen.

Cancels the order specified by `order-id`. Returns status 200 if
successful and status 400 if order ID invalid. Note that API page
says it should return 404 if the order is not found. This doesn't
seem to happen.
sourceraw docstring

common-headersclj

(common-headers access-token)
source

get-accountclj

(get-account access-token account-id)
(get-account access-token account-id fields)

Returns account balances, positions, and orders for the specified account-id. If present, fields must be a sequence of :positions and/or :orders

Returns account balances, positions, and orders for the specified
`account-id`. If present, `fields` must be a sequence of
`:positions` and/or `:orders`
sourceraw docstring

get-accountsclj

(get-accounts access-token)
(get-accounts access-token fields)

Returns account balances, positions, and orders for all linked accounts. If present, fields must be a sequence of :positions and/or :orders.

Returns account balances, positions, and orders for all linked accounts.
If present, `fields` must be a sequence of `:positions` and/or
`:orders`.
sourceraw docstring

get-hours-single-marketclj

(get-hours-single-market access-token market date)

Retrieves market hours information for the specified market on the given date. Note that date must either be today or sometime in the future, based on the current time in New York. Thus, you are in a timezone west of New York and you make this query after midnight in New York and set date to your local date, it will fail since that date will be yesterday in New York.

Valid specifiers for market include: :equity :option :future :bond :forex

date is a java.time.LocalDate or a date string in uuuu-MM-DD format.

Retrieves market hours information for the specified `market` on the
given `date`. Note that `date` must either be today or sometime in
the future, based on the current time in New York. Thus, you are in
a timezone west of New York and you make this query after midnight
in New York and set `date` to your local date, it will fail since
that date will be yesterday in New York.

Valid specifiers for `market` include:
:equity
:option
:future
:bond
:forex

`date` is a java.time.LocalDate or a date string in uuuu-MM-DD format.
sourceraw docstring

get-option-chainclj

(get-option-chain access-token
                  symbol
                  &
                  {:keys [contract-type strike-count include-quotes strategy
                          interval strike range from-date to-date exp-month
                          option-type]
                   :or {include-quotes :clj-tda.api/not-present}})

symbol : the underlying symbol as a string, keyword, or Clojure symbol

:contract-type: Type of contracts to return in the chain. Can be :call, :put, or :all. Default is :all.

:strike-count: The number of strikes to return above and below the at-the-money price.

:include-quotes: Include quotes for options in the option chain. Can be truthy or falsey. Default is false.

:strategy: Passing a value returns a Strategy Chain. Possible values are :single, :analytical (allows use of the volatility, underlyingPrice, interestRate, and daysToExpiration params to calculate theoretical values), :covered, :vertical, :calendar, :strangle, :straddle, :butterfly, :condor, :diagonal, :collar, or :roll. Default is :single.

:interval: Strike interval for spread strategy chains (see strategy param).

:strike: Provide a strike price to return options only at that strike price.

:range: Returns options for the given range. Possible values are: :itm: In-the-money :ntm: Near-the-money :otm: Out-of-the-money :sak: Strikes Above Market :sbk: Strikes Below Market :snk: Strikes Near Market :all: All Strikes (default)

:from-date: Only return expirations after this date. For strategies, expiration refers to the nearest term expiration in the strategy. Must be a java.time.LocalDate or string in uuuu-MM-DD format.

:to-date: Only return expirations before this date. For strategies, expiration refers to the nearest term expiration in the strategy. Must be a java.time.LocalDate or string in uuuu-MM-DD format.

:exp-month: Return only options expiring in the specified month. Month is given in standard three character format. Example: :jan, :feb, etc. Default is :all.

:option-type: Type of contracts to return. Possible values are: :s : Standard contracts :ns : Non-standard contracts :all: All contracts (default)

`symbol` : the underlying symbol as a string, keyword, or Clojure symbol

`:contract-type`: Type of contracts to return in the chain. Can be
`:call`, `:put`, or `:all`. Default is `:all`.

`:strike-count`: The number of strikes to return above and below the
at-the-money price.

`:include-quotes`: Include quotes for options in the option
chain. Can be truthy or falsey. Default is `false`.

`:strategy`: Passing a value returns a Strategy Chain. Possible
values are `:single`, `:analytical` (allows use of the volatility,
underlyingPrice, interestRate, and daysToExpiration params to
calculate theoretical values), `:covered`, `:vertical`, `:calendar`,
`:strangle`, `:straddle`, `:butterfly`, `:condor`, `:diagonal`, `:collar`, or
`:roll`. Default is `:single`.

`:interval`: Strike interval for spread strategy chains (see
strategy param).

`:strike`: Provide a strike price to return options only at that
strike price.

`:range`: Returns options for the given range. Possible values are:
    `:itm`: In-the-money
    `:ntm`: Near-the-money
    `:otm`: Out-of-the-money
    `:sak`: Strikes Above Market
    `:sbk`: Strikes Below Market
    `:snk`: Strikes Near Market
    `:all`: All Strikes (default)

`:from-date`: Only return expirations after this date. For
strategies, expiration refers to the nearest term expiration in the
strategy. Must be a `java.time.LocalDate` or string in uuuu-MM-DD
format.

`:to-date`: Only return expirations before this date. For
strategies, expiration refers to the nearest term expiration in the
strategy. Must be a `java.time.LocalDate` or string in uuuu-MM-DD
format.

`:exp-month`: Return only options expiring in the specified
month. Month is given in standard three character format.
Example: `:jan`, `:feb`, etc. Default is `:all`.

`:option-type`: Type of contracts to return. Possible values are:
    `:s`  : Standard contracts
    `:ns` : Non-standard contracts
    `:all`: All contracts (default)
sourceraw docstring

get-orderclj

(get-order access-token account-id order-id)

Gets information about the order specified by order-id. Returns status 200 if successful, in which case the body contains order info in JSON.

Gets information about the order specified by `order-id`. Returns
status 200 if successful, in which case the body contains order info
in JSON.
sourceraw docstring

get-orders-by-pathclj

(get-orders-by-path access-token
                    account-id
                    {:keys [max-results from-entered-time to-entered-time
                            status]})

Gets order status for multiple orders for the specified account-id.

Status may be one of: :awaiting-parent-order :awaiting-condition :awaiting-manual-review :accepted :awaiting-ur-out :pending-activation :queued :working :rejected :pending-cancel :canceled :pending-replace :replaced :filled :expired

Returns JSON in :body.

Gets order status for multiple orders for the specified `account-id`.

Status may be one of:
:awaiting-parent-order
:awaiting-condition
:awaiting-manual-review
:accepted
:awaiting-ur-out
:pending-activation
:queued
:working
:rejected
:pending-cancel
:canceled
:pending-replace
:replaced
:filled
:expired

Returns JSON in :body.
sourceraw docstring

get-quoteclj

(get-quote access-token symbol)

Get's a quote for the specified symbol.

Get's a quote for the specified `symbol`.
sourceraw docstring

get-quotesclj

(get-quotes access-token symbols)

Gets multiple quotes for the seq of symbols.

Gets multiple quotes for the seq of `symbols`.
sourceraw docstring

kw->constantclj

(kw->constant sym)
source

place-orderclj

(place-order access-token account-id order)

Places the order for the specified account-id. Returns status 201 if order accepted. Returns status 400 if the order is rejected. Note that the Location header specifies a URL that can be used to retrieve current information about the order (essentially the equivalent of get-order.

Places the `order` for the specified `account-id`. Returns status 201
if order accepted. Returns status 400 if the order is rejected. Note
that the Location header specifies a URL that can be used to
retrieve current information about the order (essentially the
equivalent of `get-order`.
sourceraw docstring

replace-orderclj

(replace-order access-token account-id order-id order)

Replaces the order specified by order-id with the new order. Returns status 201 if order replaced.

Replaces the order specified by `order-id` with the new
`order`. Returns status 201 if order replaced.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close