-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
alpaca
Kind: global class
Extends: Exchange
- fetchTime
- fetchMarkets
- fetchTrades
- fetchOrderBook
- fetchOHLCV
- fetchTicker
- fetchTickers
- createMarketOrderWithCost
- createMarketBuyOrderWithCost
- createMarketSellOrderWithCost
- createOrder
- cancelOrder
- cancelAllOrders
- fetchOrder
- fetchOrders
- fetchOpenOrders
- fetchClosedOrders
- editOrder
- fetchMyTrades
- fetchDepositAddress
- withdraw
- fetchDepositsWithdrawals
- fetchDeposits
- fetchWithdrawals
- fetchBalance
- watchTicker
- watchOHLCV
- watchOrderBook
- watchTrades
- watchMyTrades
- watchOrders
fetches the current integer timestamp in milliseconds from the exchange server
Kind: instance method of alpaca
Returns: int - the current integer timestamp in milliseconds from the exchange server
| Param | Type | Required | Description |
|---|---|---|---|
| params | object |
No | extra parameters specific to the exchange API endpoint |
alpaca.fetchTime (params?)retrieves data on all markets for alpaca
Kind: instance method of alpaca
Returns: Array<object> - an array of objects representing market data
See: https://docs.alpaca.markets/reference/get-v2-assets
| Param | Type | Required | Description |
|---|---|---|---|
| params | object |
No | extra parameters specific to the exchange api endpoint |
alpaca.fetchMarkets (params?)get the list of most recent trades for a particular symbol
Kind: instance method of alpaca
Returns: Array<Trade> - a list of trade structures
See
- https://docs.alpaca.markets/reference/cryptotrades
- https://docs.alpaca.markets/reference/cryptolatesttrades
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string |
Yes | unified symbol of the market to fetch trades for |
| since | int |
No | timestamp in ms of the earliest trade to fetch |
| limit | int |
No | the maximum amount of trades to fetch |
| params | object |
No | extra parameters specific to the exchange API endpoint |
| params.loc | string |
No | crypto location, default: us |
| params.method | string |
No | method, default: marketPublicGetV1beta3CryptoLocTrades |
alpaca.fetchTrades (symbol, since?, limit?, params?)fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
Kind: instance method of alpaca
Returns: object - A dictionary of order book structures indexed by market symbols
See: https://docs.alpaca.markets/reference/cryptolatestorderbooks
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string |
Yes | unified symbol of the market to fetch the order book for |
| limit | int |
No | the maximum amount of order book entries to return |
| params | object |
No | extra parameters specific to the exchange API endpoint |
| params.loc | string |
No | crypto location, default: us |
alpaca.fetchOrderBook (symbol, limit?, params?)fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
Kind: instance method of alpaca
Returns: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume
See
- https://docs.alpaca.markets/reference/cryptobars
- https://docs.alpaca.markets/reference/cryptolatestbars
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string |
Yes | unified symbol of the market to fetch OHLCV data for |
| timeframe | string |
Yes | the length of time each candle represents |
| since | int |
No | timestamp in ms of the earliest candle to fetch |
| limit | int |
No | the maximum amount of candles to fetch |
| params | object |
No | extra parameters specific to the alpha api endpoint |
| params.loc | string |
No | crypto location, default: us |
| params.method | string |
No | method, default: marketPublicGetV1beta3CryptoLocBars |
alpaca.fetchOHLCV (symbol, timeframe, since?, limit?, params?)fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
Kind: instance method of alpaca
Returns: object - a ticker structure
See: https://docs.alpaca.markets/reference/cryptosnapshots-1
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string |
Yes | unified symbol of the market to fetch the ticker for |
| params | object |
No | extra parameters specific to the exchange API endpoint |
| params.loc | string |
No | crypto location, default: us |
alpaca.fetchTicker (symbol, params?)fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
Kind: instance method of alpaca
Returns: object - a dictionary of ticker structures
See: https://docs.alpaca.markets/reference/cryptosnapshots-1
| Param | Type | Required | Description |
|---|---|---|---|
| symbols | Array<string> |
Yes | unified symbols of the markets to fetch tickers for |
| params | object |
No | extra parameters specific to the exchange API endpoint |
| params.loc | string |
No | crypto location, default: us |
alpaca.fetchTickers (symbols, params?)create a market order by providing the symbol, side and cost
Kind: instance method of alpaca
Returns: object - an order structure
See: https://docs.alpaca.markets/reference/postorder
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string |
Yes | unified symbol of the market to create an order in |
| side | string |
Yes | 'buy' or 'sell' |
| cost | float |
Yes | how much you want to trade in units of the quote currency |
| params | object |
No | extra parameters specific to the exchange API endpoint |
alpaca.createMarketOrderWithCost (symbol, side, cost, params?)create a market buy order by providing the symbol and cost
Kind: instance method of alpaca
Returns: object - an order structure
See: https://docs.alpaca.markets/reference/postorder
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string |
Yes | unified symbol of the market to create an order in |
| cost | float |
Yes | how much you want to trade in units of the quote currency |
| params | object |
No | extra parameters specific to the exchange API endpoint |
alpaca.createMarketBuyOrderWithCost (symbol, cost, params?)create a market sell order by providing the symbol and cost
Kind: instance method of alpaca
Returns: object - an order structure
See: https://docs.alpaca.markets/reference/postorder
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string |
Yes | unified symbol of the market to create an order in |
| cost | float |
Yes | how much you want to trade in units of the quote currency |
| params | object |
No | extra parameters specific to the exchange API endpoint |
alpaca.createMarketSellOrderWithCost (symbol, cost, params?)create a trade order
Kind: instance method of alpaca
Returns: object - an order structure
See: https://docs.alpaca.markets/reference/postorder
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string |
Yes | unified symbol of the market to create an order in |
| type | string |
Yes | 'market', 'limit' or 'stop_limit' |
| side | string |
Yes | 'buy' or 'sell' |
| amount | float |
Yes | how much of currency you want to trade in units of base currency |
| price | float |
No | the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders |
| params | object |
No | extra parameters specific to the exchange API endpoint |
| params.triggerPrice | float |
No | The price at which a trigger order is triggered at |
| params.cost | float |
No | market orders only the cost of the order in units of the quote currency |
alpaca.createOrder (symbol, type, side, amount, price?, params?)cancels an open order
Kind: instance method of alpaca
Returns: object - An order structure
See: https://docs.alpaca.markets/reference/deleteorderbyorderid
| Param | Type | Required | Description |
|---|---|---|---|
| id | string |
Yes | order id |
| symbol | string |
Yes | unified symbol of the market the order was made in |
| params | object |
No | extra parameters specific to the exchange API endpoint |
alpaca.cancelOrder (id, symbol, params?)cancel all open orders in a market
Kind: instance method of alpaca
Returns: Array<object> - a list of order structures
See: https://docs.alpaca.markets/reference/deleteallorders
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string |
Yes | alpaca cancelAllOrders cannot setting symbol, it will cancel all open orders |
| params | object |
No | extra parameters specific to the exchange API endpoint |
alpaca.cancelAllOrders (symbol, params?)fetches information on an order made by the user
Kind: instance method of alpaca
Returns: object - An order structure
See: https://docs.alpaca.markets/reference/getorderbyorderid
| Param | Type | Required | Description |
|---|---|---|---|
| id | string |
Yes | the order id |
| symbol | string |
Yes | unified symbol of the market the order was made in |
| params | object |
No | extra parameters specific to the exchange API endpoint |
alpaca.fetchOrder (id, symbol, params?)fetches information on multiple orders made by the user
Kind: instance method of alpaca
Returns: Array<Order> - a list of order structures
See: https://docs.alpaca.markets/reference/getallorders
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string |
Yes | unified market symbol of the market orders were made in |
| since | int |
No | the earliest time in ms to fetch orders for |
| limit | int |
No | the maximum number of order structures to retrieve |
| params | object |
No | extra parameters specific to the exchange API endpoint |
| params.until | int |
No | the latest time in ms to fetch orders for |
alpaca.fetchOrders (symbol, since?, limit?, params?)fetch all unfilled currently open orders
Kind: instance method of alpaca
Returns: Array<Order> - a list of order structures
See: https://docs.alpaca.markets/reference/getallorders
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string |
Yes | unified market symbol of the market orders were made in |
| since | int |
No | the earliest time in ms to fetch orders for |
| limit | int |
No | the maximum number of order structures to retrieve |
| params | object |
No | extra parameters specific to the exchange API endpoint |
| params.until | int |
No | the latest time in ms to fetch orders for |
alpaca.fetchOpenOrders (symbol, since?, limit?, params?)fetches information on multiple closed orders made by the user
Kind: instance method of alpaca
Returns: Array<Order> - a list of order structures
See: https://docs.alpaca.markets/reference/getallorders
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string |
Yes | unified market symbol of the market orders were made in |
| since | int |
No | the earliest time in ms to fetch orders for |
| limit | int |
No | the maximum number of order structures to retrieve |
| params | object |
No | extra parameters specific to the exchange API endpoint |
| params.until | int |
No | the latest time in ms to fetch orders for |
alpaca.fetchClosedOrders (symbol, since?, limit?, params?)edit a trade order
Kind: instance method of alpaca
Returns: object - an order structure
See: https://docs.alpaca.markets/reference/patchorderbyorderid-1
| Param | Type | Required | Description |
|---|---|---|---|
| id | string |
Yes | order id |
| symbol | string |
No | unified symbol of the market to create an order in |
| type | string |
No | 'market', 'limit' or 'stop_limit' |
| side | string |
No | 'buy' or 'sell' |
| amount | float |
No | how much of the currency you want to trade in units of the base currency |
| price | float |
No | the price for the order, in units of the quote currency, ignored in market orders |
| params | object |
No | extra parameters specific to the exchange API endpoint |
| params.triggerPrice | string |
No | the price to trigger a stop order |
| params.timeInForce | string |
No | for crypto trading either 'gtc' or 'ioc' can be used |
| params.clientOrderId | string |
No | a unique identifier for the order, automatically generated if not sent |
alpaca.editOrder (id, symbol?, type?, side?, amount?, price?, params?)fetch all trades made by the user
Kind: instance method of alpaca
Returns: Array<Trade> - a list of trade structures
See: https://docs.alpaca.markets/reference/getaccountactivitiesbyactivitytype-1
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string |
No | unified market symbol |
| since | int |
No | the earliest time in ms to fetch trades for |
| limit | int |
No | the maximum number of trade structures to retrieve |
| params | object |
No | extra parameters specific to the exchange API endpoint |
| params.until | int |
No | the latest time in ms to fetch trades for |
| params.page_token | string |
No | page_token - used for paging |
alpaca.fetchMyTrades (symbol?, since?, limit?, params?)fetch the deposit address for a currency associated with this account
Kind: instance method of alpaca
Returns: object - an address structure
See: https://docs.alpaca.markets/reference/listcryptofundingwallets
| Param | Type | Required | Description |
|---|---|---|---|
| code | string |
Yes | unified currency code |
| params | object |
No | extra parameters specific to the exchange API endpoint |
alpaca.fetchDepositAddress (code, params?)make a withdrawal
Kind: instance method of alpaca
Returns: object - a transaction structure
See: https://docs.alpaca.markets/reference/createcryptotransferforaccount
| Param | Type | Required | Description |
|---|---|---|---|
| code | string |
Yes | unified currency code |
| amount | float |
Yes | the amount to withdraw |
| address | string |
Yes | the address to withdraw to |
| tag | string |
Yes | a memo for the transaction |
| params | object |
No | extra parameters specific to the exchange API endpoint |
alpaca.withdraw (code, amount, address, tag, params?)fetch history of deposits and withdrawals
Kind: instance method of alpaca
Returns: object - a list of transaction structure
See: https://docs.alpaca.markets/reference/listcryptofundingtransfers
| Param | Type | Required | Description |
|---|---|---|---|
| code | string |
No | unified currency code for the currency of the deposit/withdrawals, default is undefined |
| since | int |
No | timestamp in ms of the earliest deposit/withdrawal, default is undefined |
| limit | int |
No | max number of deposit/withdrawals to return, default is undefined |
| params | object |
No | extra parameters specific to the exchange API endpoint |
alpaca.fetchDepositsWithdrawals (code?, since?, limit?, params?)fetch all deposits made to an account
Kind: instance method of alpaca
Returns: Array<object> - a list of transaction structures
See: https://docs.alpaca.markets/reference/listcryptofundingtransfers
| Param | Type | Required | Description |
|---|---|---|---|
| code | string |
No | unified currency code |
| since | int |
No | the earliest time in ms to fetch deposits for |
| limit | int |
No | the maximum number of deposit structures to retrieve |
| params | object |
No | extra parameters specific to the exchange API endpoint |
alpaca.fetchDeposits (code?, since?, limit?, params?)fetch all withdrawals made from an account
Kind: instance method of alpaca
Returns: Array<object> - a list of transaction structures
See: https://docs.alpaca.markets/reference/listcryptofundingtransfers
| Param | Type | Required | Description |
|---|---|---|---|
| code | string |
No | unified currency code |
| since | int |
No | the earliest time in ms to fetch withdrawals for |
| limit | int |
No | the maximum number of withdrawal structures to retrieve |
| params | object |
No | extra parameters specific to the exchange API endpoint |
alpaca.fetchWithdrawals (code?, since?, limit?, params?)query for balance and get the amount of funds available for trading or funds locked in orders
Kind: instance method of alpaca
Returns: object - a balance structure
See: https://docs.alpaca.markets/reference/getaccount-1
| Param | Type | Required | Description |
|---|---|---|---|
| params | object |
No | extra parameters specific to the exchange API endpoint |
alpaca.fetchBalance (params?)watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
Kind: instance method of alpaca
Returns: object - a ticker structure
See: https://docs.alpaca.markets/docs/real-time-crypto-pricing-data#quotes
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string |
Yes | unified symbol of the market to fetch the ticker for |
| params | object |
No | extra parameters specific to the exchange API endpoint |
alpaca.watchTicker (symbol, params?)watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
Kind: instance method of alpaca
Returns: Array<Array<int>> - A list of candles ordered as timestamp, open, high, low, close, volume
See: https://docs.alpaca.markets/docs/real-time-crypto-pricing-data#bars
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string |
Yes | unified symbol of the market to fetch OHLCV data for |
| timeframe | string |
Yes | the length of time each candle represents |
| since | int |
No | timestamp in ms of the earliest candle to fetch |
| limit | int |
No | the maximum amount of candles to fetch |
| params | object |
No | extra parameters specific to the exchange API endpoint |
alpaca.watchOHLCV (symbol, timeframe, since?, limit?, params?)watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
Kind: instance method of alpaca
Returns: object - A dictionary of order book structures indexed by market symbols
See: https://docs.alpaca.markets/docs/real-time-crypto-pricing-data#orderbooks
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string |
Yes | unified symbol of the market to fetch the order book for |
| limit | int |
No | the maximum amount of order book entries to return. |
| params | object |
No | extra parameters specific to the exchange API endpoint |
alpaca.watchOrderBook (symbol, limit?, params?)watches information on multiple trades made in a market
Kind: instance method of alpaca
Returns: Array<object> - a list of trade structures
See: https://docs.alpaca.markets/docs/real-time-crypto-pricing-data#trades
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string |
Yes | unified market symbol of the market trades were made in |
| since | int |
No | the earliest time in ms to fetch orders for |
| limit | int |
No | the maximum number of trade structures to retrieve |
| params | object |
No | extra parameters specific to the exchange API endpoint |
alpaca.watchTrades (symbol, since?, limit?, params?)watches information on multiple trades made by the user
Kind: instance method of alpaca
Returns: Array<object> - a list of trade structures
See: https://docs.alpaca.markets/docs/websocket-streaming#trade-updates
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string |
Yes | unified market symbol of the market trades were made in |
| since | int |
No | the earliest time in ms to fetch trades for |
| limit | int |
No | the maximum number of trade structures to retrieve |
| params | object |
No | extra parameters specific to the exchange API endpoint |
| params.unifiedMargin | boolean |
No | use unified margin account |
alpaca.watchMyTrades (symbol, since?, limit?, params?)watches information on multiple orders made by the user
Kind: instance method of alpaca
Returns: Array<object> - a list of order structures
| Param | Type | Required | Description |
|---|---|---|---|
| symbol | string |
Yes | unified market symbol of the market orders were made in |
| since | int |
No | the earliest time in ms to fetch orders for |
| limit | int |
No | the maximum number of order structures to retrieve |
| params | object |
No | extra parameters specific to the exchange API endpoint |
alpaca.watchOrders (symbol, since?, limit?, params?)(If the page is not being rendered for you, you can refer to the mirror at https://docs.ccxt.com/)
- Install
- Examples
- Manual
- CCXT Pro
- Contributing
- Supported Exchanges
- Exchanges By Country
- API Spec By Method
- FAQ
- Changelog
- Awesome
- API Spec by Exchange
- fetchCurrencies
- alpaca
- apex
- ascendex
- aster
- backpack
- bigone
- binance
- bingx
- bit2c
- bitbank
- bitbns
- bitfinex
- bitflyer
- bitget
- bithumb
- bitmart
- bitmex
- bitopro
- bitrue
- bitso
- bitstamp
- bitteam
- bittrade
- bitvavo
- blockchaincom
- blofin
- btcbox
- btcmarkets
- btcturk
- bullish
- bybit
- bydfi
- cex
- coinbase
- coinbaseexchange
- coinbaseinternational
- coincheck
- coinex
- coinmate
- coinmetro
- coinone
- coinsph
- coinspot
- cryptocom
- cryptomus
- deepcoin
- delta
- deribit
- derive
- digifinex
- dydx
- exmo
- extended
- foxbit
- gate
- gemini
- grvt
- hashkey
- hibachi
- hitbtc
- hollaex
- htx
- hyperliquid
- independentreserve
- indodax
- kraken
- krakenfutures
- kucoin
- fetchBidsAsks
- latoken
- lbank
- lighter
- luno
- mercado
- mexc
- modetrade
- ndax
- novadax
- okx
- onetrading
- p2b
- pacifica
- paradex
- paymium
- phemex
- poloniex
- tokocrypto
- toobit
- upbit
- weex
- whitebit
- woo
- woofipro
- xt
- zaif
- fetchStatus