removed unref parameter for market making
This commit is contained in:
parent
871a5e55b7
commit
a0d8cedef8
|
@ -15,8 +15,8 @@ import { ChildProcess, fork } from "child_process";
|
||||||
import { FileKeypair } from "./fileKeypair";
|
import { FileKeypair } from "./fileKeypair";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param lotSize
|
* @param lotSize This is the smallest representable amount of the base coin .
|
||||||
* @param tickSize
|
* @param tickSize This is the smallest representable amount of the quote coin.
|
||||||
* @param feeRate
|
* @param feeRate
|
||||||
* @param quoteDustThreshold
|
* @param quoteDustThreshold
|
||||||
*/
|
*/
|
||||||
|
@ -28,7 +28,6 @@ export type MarketParams = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param unref
|
|
||||||
* @param durationInSecs
|
* @param durationInSecs
|
||||||
* @param orderCount
|
* @param orderCount
|
||||||
* @param initialBidSize
|
* @param initialBidSize
|
||||||
|
@ -36,7 +35,7 @@ export type MarketParams = {
|
||||||
* @param quoteGeckoSymbol
|
* @param quoteGeckoSymbol
|
||||||
*/
|
*/
|
||||||
type MarketMakerOpts = {
|
type MarketMakerOpts = {
|
||||||
unref: boolean;
|
// unref: boolean;
|
||||||
durationInSecs: number;
|
durationInSecs: number;
|
||||||
orderCount: number;
|
orderCount: number;
|
||||||
initialBidSize: number;
|
initialBidSize: number;
|
||||||
|
@ -255,7 +254,12 @@ export class Dex {
|
||||||
owner: FileKeypair,
|
owner: FileKeypair,
|
||||||
opts: MarketMakerOpts,
|
opts: MarketMakerOpts,
|
||||||
): ChildProcess {
|
): ChildProcess {
|
||||||
|
if (opts.durationInSecs < 0)
|
||||||
|
throw new Error("Duration must be greater than 0.");
|
||||||
|
|
||||||
const child = fork(`${__dirname}/scripts/marketMaker`, null, {
|
const child = fork(`${__dirname}/scripts/marketMaker`, null, {
|
||||||
|
// https://nodejs.org/api/child_process.html#optionsdetached
|
||||||
|
// detached also doesn't seem to be making a difference.
|
||||||
detached: true,
|
detached: true,
|
||||||
stdio: ["pipe", 0, 0, "ipc"],
|
stdio: ["pipe", 0, 0, "ipc"],
|
||||||
});
|
});
|
||||||
|
@ -264,8 +268,11 @@ export class Dex {
|
||||||
`Process ${child.pid}: Running Market Maker for ${market.baseCoin.symbol}/${market.quoteCoin.symbol}. Note: No crank running`,
|
`Process ${child.pid}: Running Market Maker for ${market.baseCoin.symbol}/${market.quoteCoin.symbol}. Note: No crank running`,
|
||||||
);
|
);
|
||||||
|
|
||||||
// https://nodejs.org/api/child_process.html#optionsdetached
|
// unref doesn't seem to be making a difference for a forked process.
|
||||||
if (opts.unref) child.unref();
|
// but process is detached so parent can exit manually
|
||||||
|
|
||||||
|
// https://nodejs.org/api/child_process.html#subprocessunref
|
||||||
|
// if (opts.unref) child.unref;
|
||||||
|
|
||||||
child.send({
|
child.send({
|
||||||
action: "start",
|
action: "start",
|
||||||
|
|
Loading…
Reference in New Issue