Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
feat(crypto): add temporary hack for customBase
Browse files Browse the repository at this point in the history
chore(package.json): update version to 7.0.12-alpha

chore(package-lock.json): update version to 7.0.12-alpha

refactor(positions): rename getAllOpenPositions to getPositions

feat(stocks): add temporary hack for customBase
  • Loading branch information
117 committed Aug 8, 2023
1 parent 808cc4c commit 7819bd6
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 10 deletions.
17 changes: 15 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@master-chief/alpaca-ts",
"version": "7.0.11-alpha",
"version": "7.0.12-alpha",
"description": "A TypeScript Node.js library for the https://alpaca.markets REST API and WebSocket streams.",
"author": "117",
"contributors": [
Expand Down Expand Up @@ -52,10 +52,12 @@
"dependencies": {
"axios": "^1.4.0",
"form-data": "^4.0.0",
"lodash-es": "^4.17.21",
"openapi-fetch": "^0.6.1",
"qs": "^6.9.6"
},
"devDependencies": {
"@types/lodash": "^4.14.196",
"@types/node": "^20.4.8",
"@types/qs": "^6.9.5",
"prettier": "^2.8.8",
Expand Down
9 changes: 6 additions & 3 deletions src/services/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ import type { MultiSnapshotResponse } from "../entities/MultiSnapshotResponse.js
import type { MultiTradesResponse } from "../entities/MultiTradesResponse.js";
import type { CancelablePromise } from "../rest/CancelablePromise.js";
import type { BaseHttpRequest } from "../rest/BaseHttpRequest.js";
import { cloneDeep } from "lodash-es";

const BASE = "https://data.alpaca.markets";

const customBase = (httpRequest: BaseHttpRequest) => {
httpRequest.config.BASE = BASE;
return httpRequest;
// todo: this is a temporary hack
const customBase = (httpRequest: BaseHttpRequest): BaseHttpRequest => {
const clonedRequest = cloneDeep(httpRequest);
clonedRequest.config.BASE = BASE;
return clonedRequest;
};

/**
Expand Down
2 changes: 1 addition & 1 deletion src/services/positions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type { BaseHttpRequest } from "../rest/BaseHttpRequest.js";
* @returns Position Successful response
* @throws ApiError
*/
export const getAllOpenPositions = (
export const getPositions = (
httpRequest: BaseHttpRequest
): CancelablePromise<Array<Position>> => {
return httpRequest.request({
Expand Down
10 changes: 7 additions & 3 deletions src/services/stocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ import type { MultiTradesResponse } from "../entities/MultiTradesResponse.js";
import type { CancelablePromise } from "../rest/CancelablePromise.js";
import type { BaseHttpRequest } from "../rest/BaseHttpRequest.js";

import { cloneDeep } from "lodash-es";

const BASE = "https://data.alpaca.markets";

const customBase = (httpRequest: BaseHttpRequest) => {
httpRequest.config.BASE = BASE;
return httpRequest;
// todo: this is a temporary hack
const customBase = (httpRequest: BaseHttpRequest): BaseHttpRequest => {
const clonedRequest = cloneDeep(httpRequest);
clonedRequest.config.BASE = BASE;
return clonedRequest;
};

/**
Expand Down

0 comments on commit 7819bd6

Please sign in to comment.