hedge-broker 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +31 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -648,36 +648,50 @@ Track with: hedge status ${submissionId} (or use finalize --wait next time)
|
|
|
648
648
|
}
|
|
649
649
|
const timeoutMin = intFlag(opts.timeout, "--timeout");
|
|
650
650
|
const deadline = Date.now() + Math.max(1, timeoutMin) * 6e4;
|
|
651
|
-
process.stdout.write("Marketing started - waiting for markets to
|
|
652
|
-
let
|
|
651
|
+
process.stdout.write("Marketing started - waiting for markets to match (usually ~5 minutes)");
|
|
652
|
+
let req = null;
|
|
653
|
+
let noMarkets = false;
|
|
653
654
|
while (Date.now() < deadline) {
|
|
654
655
|
await new Promise((resolve) => setTimeout(resolve, 15e3));
|
|
655
656
|
process.stdout.write(".");
|
|
656
|
-
const
|
|
657
|
-
if (
|
|
658
|
-
|
|
657
|
+
const view = await apiRequest(ctx.client, "GET", `/broker/submissions/${submissionId}/requirements`);
|
|
658
|
+
if (view.marketing_status === "matched" || view.markets?.length) {
|
|
659
|
+
req = view;
|
|
660
|
+
break;
|
|
661
|
+
}
|
|
662
|
+
if (view.marketing_status === "no_markets_matched") {
|
|
663
|
+
req = view;
|
|
664
|
+
noMarkets = true;
|
|
659
665
|
break;
|
|
660
666
|
}
|
|
661
667
|
}
|
|
662
668
|
process.stdout.write("\n");
|
|
663
|
-
if (!
|
|
669
|
+
if (!req) {
|
|
664
670
|
process.stdout.write(
|
|
665
671
|
`Still matching after ${timeoutMin} minutes - this can occasionally take longer.
|
|
666
|
-
Check in with: hedge
|
|
672
|
+
Check in with: hedge requirements ${submissionId}
|
|
667
673
|
`
|
|
668
674
|
);
|
|
669
675
|
return;
|
|
670
676
|
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
}
|
|
676
|
-
if (ctx.json) return printJson({ finalize: r,
|
|
677
|
-
|
|
677
|
+
if (noMarkets) {
|
|
678
|
+
if (ctx.json) return printJson({ finalize: r, requirements: req });
|
|
679
|
+
process.stdout.write((req.marketing_hint ?? "No carrier lanes attached - Hedge is reviewing options for this risk and will follow up.") + "\n");
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
if (ctx.json) return printJson({ finalize: r, requirements: req });
|
|
683
|
+
const rows = (req.markets || []).map((m) => ({
|
|
684
|
+
market: m.market_name,
|
|
685
|
+
ready: m.ready ? "yes" : "no",
|
|
686
|
+
needs_from_you: (m.needs_from_you || []).join("; ")
|
|
687
|
+
}));
|
|
688
|
+
process.stdout.write(`Matched ${rows.length} market(s):
|
|
678
689
|
|
|
679
|
-
` + table(rows, ["
|
|
680
|
-
|
|
690
|
+
` + table(rows, ["market", "ready", "needs_from_you"]) + "\n");
|
|
691
|
+
if (req.forms?.length) {
|
|
692
|
+
process.stdout.write("\nForms Hedge prepares: " + req.forms.join(", ") + "\n(download blanks with: hedge form <form_key>)\n");
|
|
693
|
+
}
|
|
694
|
+
process.stdout.write("\nTrack sends and quotes with: hedge status " + submissionId + "\n");
|
|
681
695
|
});
|
|
682
696
|
program2.command("forms [search]").description('Search the blank application-form catalog, e.g. hedge forms "liquor"').action(async (search) => {
|
|
683
697
|
const ctx = makeCtx(program2.opts());
|
|
@@ -873,7 +887,7 @@ function registerQuotes(program2) {
|
|
|
873
887
|
|
|
874
888
|
// src/index.ts
|
|
875
889
|
var program = new Command();
|
|
876
|
-
program.name("hedge").description("Submit risks to Hedge and track them from your terminal.").version("0.3.
|
|
890
|
+
program.name("hedge").description("Submit risks to Hedge and track them from your terminal.").version("0.3.2").option("--staging", "use the staging environment").option("--json", "output raw JSON (for scripting)");
|
|
877
891
|
registerAuth(program);
|
|
878
892
|
registerSubmissions(program);
|
|
879
893
|
registerAppetite(program);
|
package/package.json
CHANGED