-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Deprecate public orders (#81)
- Loading branch information
1 parent
7f6ae56
commit 72a9d28
Showing
3 changed files
with
36 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,5 +48,5 @@ | |
"peerDependencies": { | ||
"typescript": "^5.6.2" | ||
}, | ||
"version": "0.1.54" | ||
} | ||
"version": "0.1.55" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import { type Command, Option } from "@commander-js/extra-typings"; | ||
import dayjs from "dayjs"; | ||
import { render } from "ink"; | ||
import * as console from "node:console"; | ||
import duration from "npm:[email protected]/plugin/duration.js"; | ||
import relativeTime from "npm:[email protected]/plugin/relativeTime.js"; | ||
import React from "react"; | ||
|
@@ -12,11 +13,10 @@ import { | |
logSessionTokenExpiredAndQuit, | ||
} from "../../helpers/errors.ts"; | ||
import { fetchAndHandleErrors } from "../../helpers/fetch.ts"; | ||
import { getApiUrl } from "../../helpers/urls.ts"; | ||
import { parseStartDate } from "../../helpers/units.ts"; | ||
import { getApiUrl } from "../../helpers/urls.ts"; | ||
import { OrderDisplay } from "./OrderDisplay.tsx"; | ||
import type { HydratedOrder, ListResponseBody } from "./types.ts"; | ||
import * as console from "node:console"; | ||
|
||
dayjs.extend(relativeTime); | ||
dayjs.extend(duration); | ||
|
@@ -65,7 +65,7 @@ export function registerOrders(program: Command) { | |
.addOption( | ||
new Option( | ||
"--public", | ||
"Include public orders. Only includes open orders.", | ||
"This option is deprecated. It's no longer possible to view public orders.", | ||
) | ||
.conflicts(["onlyFilled", "onlyCancelled"]) | ||
.implies({ | ||
|
@@ -75,12 +75,12 @@ export function registerOrders(program: Command) { | |
.option( | ||
"--min-price <price>", | ||
"Filter by minimum price (in cents)", | ||
parseInt, | ||
Number.parseInt, | ||
) | ||
.option( | ||
"--max-price <price>", | ||
"Filter by maximum price (in cents)", | ||
parseInt, | ||
Number.parseInt, | ||
) | ||
.option( | ||
"--min-start <date>", | ||
|
@@ -98,23 +98,38 @@ export function registerOrders(program: Command) { | |
"--max-duration <duration>", | ||
"Filter by maximum duration (in seconds)", | ||
) | ||
.option("--min-quantity <quantity>", "Filter by minimum quantity", parseInt) | ||
.option("--max-quantity <quantity>", "Filter by maximum quantity", parseInt) | ||
.option( | ||
"--min-quantity <quantity>", | ||
"Filter by minimum quantity", | ||
Number.parseInt, | ||
) | ||
.option( | ||
"--max-quantity <quantity>", | ||
"Filter by maximum quantity", | ||
Number.parseInt, | ||
) | ||
.option( | ||
"--contract-id <id>", | ||
"Filter by contract ID (only for sell orders)", | ||
) | ||
.addOption( | ||
new Option("--only-open", "Show only open orders") | ||
.conflicts(["onlyFilled", "onlyCancelled"]), | ||
new Option("--only-open", "Show only open orders").conflicts([ | ||
"onlyFilled", | ||
"onlyCancelled", | ||
]), | ||
) | ||
.addOption( | ||
new Option("--exclude-filled", "Exclude filled orders") | ||
.conflicts(["onlyFilled"]), | ||
new Option("--exclude-filled", "Exclude filled orders").conflicts([ | ||
"onlyFilled", | ||
]), | ||
) | ||
.addOption( | ||
new Option("--only-filled", "Show only filled orders") | ||
.conflicts(["excludeFilled", "onlyCancelled", "onlyOpen", "public"]), | ||
new Option("--only-filled", "Show only filled orders").conflicts([ | ||
"excludeFilled", | ||
"onlyCancelled", | ||
"onlyOpen", | ||
"public", | ||
]), | ||
) | ||
.option( | ||
"--min-filled-at <date>", | ||
|
@@ -127,17 +142,14 @@ export function registerOrders(program: Command) { | |
.option( | ||
"--min-fill-price <price>", | ||
"Filter by minimum fill price (in cents)", | ||
parseInt, | ||
Number.parseInt, | ||
) | ||
.option( | ||
"--max-fill-price <price>", | ||
"Filter by maximum fill price (in cents)", | ||
parseInt, | ||
) | ||
.option( | ||
"--include-cancelled", | ||
"Include cancelled orders", | ||
Number.parseInt, | ||
) | ||
.option("--include-cancelled", "Include cancelled orders") | ||
.addOption( | ||
new Option("--only-cancelled", "Show only cancelled orders") | ||
.conflicts(["onlyFilled", "onlyOpen", "public"]) | ||
|
@@ -161,11 +173,11 @@ export function registerOrders(program: Command) { | |
"--max-placed-at <date>", | ||
"Filter by maximum placed date (ISO 8601 datestring)", | ||
) | ||
.option("--limit <number>", "Limit the number of results", parseInt) | ||
.option("--limit <number>", "Limit the number of results", Number.parseInt) | ||
.option( | ||
"--offset <number>", | ||
"Offset the results (for pagination)", | ||
parseInt, | ||
Number.parseInt, | ||
) | ||
.option("--json", "Output in JSON format") | ||
.action(async (options) => { | ||
|
@@ -175,8 +187,6 @@ export function registerOrders(program: Command) { | |
side: options.side, | ||
instance_type: options.type, | ||
|
||
include_public: options.public, | ||
|
||
min_price: options.minPrice, | ||
max_price: options.maxPrice, | ||
min_start_date: options.minStart, | ||
|
@@ -236,8 +246,6 @@ export async function getOrders(props: { | |
side?: "buy" | "sell"; | ||
instance_type?: string; | ||
|
||
include_public?: boolean; | ||
|
||
min_price?: number; | ||
max_price?: number; | ||
min_start_date?: string; | ||
|
@@ -307,9 +315,7 @@ export async function getOrders(props: { | |
return resp.data; | ||
} | ||
|
||
export async function submitOrderCancellationByIdAction( | ||
orderId: string, | ||
) { | ||
export async function submitOrderCancellationByIdAction(orderId: string) { | ||
const loggedIn = await isLoggedIn(); | ||
if (!loggedIn) { | ||
logLoginMessageAndQuit(); | ||
|