UNPKG

@master-chief/alpaca-ts

Version:

A TypeScript Node.js library for the https://alpaca.markets REST API and WebSocket streams.

84 lines 2.58 kB
/** * Get account activities of one type * Returns account activity entries for many types of activities. * @returns any returns an array of Account activities * @throws ApiError */ export const getAccountActivities = (httpRequest, { activityTypes, }) => httpRequest.request({ method: "GET", url: "/v2/account/activities", query: { activity_types: activityTypes, }, }); /** * Get account activities of one type * Returns account activity entries for a specific type of activity. * @returns any returns an array of Account activities * @throws ApiError */ export const getAccountActivitiesByType = (httpRequest, { activityType, date, until, after, direction, pageSize, pageToken, category, }) => httpRequest.request({ method: "GET", url: "/v2/account/activities/{activity_type}", path: { activity_type: activityType, }, query: { date: date, until: until, after: after, direction: direction, page_size: pageSize, page_token: pageToken, category: category, }, }); /** * Get account * Returns the account associated with the API key. * @returns Account OK * @throws ApiError */ export const getAccount = (httpRequest) => httpRequest.request({ method: "GET", url: "/v2/account", }); /** * Account Portfolio History * Returns timeseries data about equity and profit/loss (P/L) of the account in requested timespan. * @returns PortfolioHistory Successful response * @throws ApiError */ export const getAccountPortfolioHistory = (httpRequest, { period, timeframe, dateEnd, extendedHours, }) => httpRequest.request({ method: "GET", url: "/v2/account/portfolio/history", query: { period: period, timeframe: timeframe, date_end: dateEnd, extended_hours: extendedHours, }, }); /** * Account Configurations * gets the current account configuration values * @returns AccountConfigurations Successful response * @throws ApiError */ export const getAccountConfigurations = (httpRequest) => httpRequest.request({ method: "GET", url: "/v2/account/configurations", }); /** * Account Configurations * Updates and returns the current account configuration values * @returns AccountConfigurations Successful response * @throws ApiError */ export const patchAccountConfigurations = (httpRequest, { requestBody, }) => httpRequest.request({ method: "PATCH", url: "/v2/account/configurations", body: requestBody, mediaType: "application/json", }); //# sourceMappingURL=account.js.map