@gbozee/ultimate 0.0.2-35 → 0.0.2-37

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.d.ts CHANGED
@@ -898,6 +898,12 @@ declare class ExchangeAccount$1 {
898
898
  raw?: boolean;
899
899
  use_current?: boolean;
900
900
  }): Promise<any>;
901
+ getOrCreatePositionConfig(payload: {
902
+ symbol: string;
903
+ kind: "long" | "short";
904
+ risk?: number;
905
+ risk_reward?: number;
906
+ }): Promise<ScheduledTrade | import("pocketbase").RecordModel>;
901
907
  getPositionConfig(payload: {
902
908
  symbol: string;
903
909
  kind: "long" | "short";
package/dist/index.js CHANGED
@@ -34709,6 +34709,9 @@ class BinanceExchange {
34709
34709
  }
34710
34710
  async setLeverage(payload) {
34711
34711
  let maxLeverage = payload.leverage;
34712
+ if (["BTCUSDT", "BTCUSDC"].includes(payload.symbol)) {
34713
+ maxLeverage = 100;
34714
+ }
34712
34715
  if (!maxLeverage) {
34713
34716
  const response = await this.client.getNotionalAndLeverageBrackets({
34714
34717
  symbol: payload.symbol
@@ -36704,6 +36707,31 @@ class ExchangeAccount {
36704
36707
  stop_orders
36705
36708
  };
36706
36709
  }
36710
+ async getOrCreatePositionConfig(payload) {
36711
+ const { symbol, kind, risk = 50, risk_reward = 199 } = payload;
36712
+ const config = await this.getPositionConfig({
36713
+ symbol: payload.symbol,
36714
+ kind: payload.kind
36715
+ });
36716
+ if (!config) {
36717
+ const long_c = await this.buildConfigForSymbol({
36718
+ symbol,
36719
+ risk,
36720
+ risk_reward
36721
+ });
36722
+ return this.getPositionConfig({
36723
+ symbol,
36724
+ kind,
36725
+ params: {
36726
+ entry: kind === "long" ? long_c.entry : long_c.stop,
36727
+ stop: kind === "long" ? long_c.stop : long_c.entry,
36728
+ risk_reward: long_c.risk_reward,
36729
+ risk: long_c.risk
36730
+ }
36731
+ });
36732
+ }
36733
+ return config;
36734
+ }
36707
36735
  async getPositionConfig(payload) {
36708
36736
  if (payload.params) {
36709
36737
  const db_position = await this.syncAccount({
@@ -38132,6 +38160,7 @@ class App {
38132
38160
  }
38133
38161
  const positions = await this.app_db.hasExistingPosition(symbol);
38134
38162
  if (positions.length === 0) {
38163
+ console.log("Removing symbol from DB", symbol);
38135
38164
  return this.app_db.unwindSymbolFromDB(symbol);
38136
38165
  }
38137
38166
  const unique_instances = new Set(positions.map((x) => `${x.symbol}-${x.expand.account.owner}-${x.expand.account.exchange}`));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gbozee/ultimate",
3
3
  "type": "module",
4
- "version": "0.0.2-35",
4
+ "version": "0.0.2-37",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",