Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/lib/buy/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ function _registerBuy(program: Command) {
"--standing",
"Places a standing order. Default behavior is to place a market order.",
)
.option(
"-c, --cluster <cluster>",
"Send into a specific cluster"
)
.configureHelp({
optionDescription: (option) => {
if (option.flags === "-h, --help") {
Expand Down Expand Up @@ -242,6 +246,7 @@ function QuoteAndBuy(props: { options: SfBuyOptions }) {
colocate,
yes,
standing,
cluster,
} = props.options;

setOrderProps({
Expand Down Expand Up @@ -355,6 +360,7 @@ type BuyOrderProps = {
colocate?: Array<string>;
yes?: boolean;
standing?: boolean;
cluster?: string;
};

function BuyOrder(props: BuyOrderProps) {
Expand Down Expand Up @@ -385,6 +391,7 @@ function BuyOrder(props: BuyOrderProps) {
colocateWith: props.colocate || [],
numberNodes: props.size,
standing: props.standing,
cluster: props.cluster,
});
setOrder(order);
}, [props]);
Expand Down Expand Up @@ -560,6 +567,7 @@ export async function placeBuyOrder(options: {
colocateWith: Array<string>;
numberNodes: number;
standing?: boolean;
cluster?: string;
}) {
invariant(
options.totalPriceInCents === Math.ceil(options.totalPriceInCents),
Expand Down Expand Up @@ -597,6 +605,7 @@ export async function placeBuyOrder(options: {
flags: {
ioc: !options.standing,
},
cluster: options.cluster,
} as const;
const { data, error, response } = await api.POST("/v0/orders", {
body,
Expand Down Expand Up @@ -681,6 +690,8 @@ type QuoteOptions = {
maxStartTime: Date | "NOW";
minDurationSeconds: number;
maxDurationSeconds: number;
cluster?: string;
colocateWith?: Array<string>;
};
export async function getQuote(options: QuoteOptions) {
const api = await apiClient();
Expand All @@ -698,6 +709,8 @@ export async function getQuote(options: QuoteOptions) {
: options.maxStartTime.toISOString(),
min_duration: options.minDurationSeconds,
max_duration: options.maxDurationSeconds,
cluster: options.cluster,
colocate_with: options.colocateWith,
},
} as const;

Expand Down
Loading