Skip to content

Commit

Permalink
Update to the latest Haas definitions.
Browse files Browse the repository at this point in the history
  • Loading branch information
FiretronP75 committed Dec 13, 2023
1 parent 0e01f97 commit 296d801
Show file tree
Hide file tree
Showing 25 changed files with 1,873 additions and 56 deletions.
35 changes: 35 additions & 0 deletions haas-production/hs.custom-commands.def.lua
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,19 @@ function CC_EMAMA_LB(chartIndex, interval) end
--- @return void
function CC_FlashCrashSlot(basePrice, index, amount, spread, startWithBuy) end

--- The optional parameters of CC_HMA.
--- @shape OptionalParametersOf_CC_HMA
--- @field maType Enum | nil Type of Moving Average

--- Hull Moving Average by pshai
--- @param source number[] Source data. Suggestions: ClosePrices, Prices
--- @param period number Period Length. Suggestions: Input, InputAccount, InputAccountMarket, InputButton, InputCdlTypes, InputConstant, InputGroupHeader, InputInterval, InputLrTypes, InputMarket, InputMaTypes, InputOptions, InputOrderType, InputPriceSource, InputPriceSourceMarket, InputSignalManagement, InputSignalTypes, InputSourcePrice, InputTable, InputTableColumn, InputTableOptions, AccountGuid, CurrentInterval, Fee, Leverage, PriceMarket, TradeAmount
--- @param maType Enum Optional - Type of Moving Average. Suggestions: InputMaTypes
--- @return number[] Hull Moving Average values array
--- @overload fun(source: number[], period: number): number[]
--- @overload fun(source: number[], period: number, optionalParameters: OptionalParametersOf_CC_HMA): number[]
function CC_HMA(source, period, maType) end

--- The optional parameters of CC_HullMA.
--- @shape OptionalParametersOf_CC_HullMA
--- @field Source number[] | nil The source data
Expand Down Expand Up @@ -407,6 +420,28 @@ function CC_ScalperChannel_LB(chartIndex, interval) end
--- @overload fun(chartIndex: number, optionalParameters: OptionalParametersOf_CC_SQZMOM_LB): Enum
function CC_SQZMOM_LB(chartIndex, interval) end

--- The optional parameters of CC_SQZMOM_LB_Ext.
--- @shape OptionalParametersOf_CC_SQZMOM_LB_Ext
--- @field ma_type Enum | nil BB Moving Average Type
--- @field ma_type_kc Enum | nil KC Moving Average Type
--- @field ma_type_r Enum | nil Range Moving Average Type

--- Squeeze Momentum Indicator - LazyBear
--- @param source number[] Source prices for calculations. Suggestions: AskPrices, BuyPrices, BidPrices, SellPrices, ClosePrices, Prices, CurrentPrice, GetBodyHighPrices, GetBodyLowPrices, GetVolume, HeikenClosePrices, OHLCPrices, HeikinOpenPrices, HighPrices, HLCPrices, HLPrices, LowPrices, OCPrices, OpenPrices, SourcePrices
--- @param length number BB Lenght. Suggestions: Input, InputAccount, InputAccountMarket, InputButton, InputCdlTypes, InputConstant, InputGroupHeader, InputInterval, InputLrTypes, InputMarket, InputMaTypes, InputOptions, InputOrderType, InputPriceSource, InputPriceSourceMarket, InputSignalManagement, InputSignalTypes, InputSourcePrice, InputTable, InputTableColumn, InputTableOptions, AccountGuid, CurrentInterval, Fee, Leverage, PriceMarket, TradeAmount
--- @param mult number BB MultFactor. Suggestions: Input, InputAccount, InputAccountMarket, InputButton, InputCdlTypes, InputConstant, InputGroupHeader, InputInterval, InputLrTypes, InputMarket, InputMaTypes, InputOptions, InputOrderType, InputPriceSource, InputPriceSourceMarket, InputSignalManagement, InputSignalTypes, InputSourcePrice, InputTable, InputTableColumn, InputTableOptions, AccountGuid, CurrentInterval, Fee, Leverage, PriceMarket, TradeAmount
--- @param length_kc number KC Length. Suggestions: Input, InputAccount, InputAccountMarket, InputButton, InputCdlTypes, InputConstant, InputGroupHeader, InputInterval, InputLrTypes, InputMarket, InputMaTypes, InputOptions, InputOrderType, InputPriceSource, InputPriceSourceMarket, InputSignalManagement, InputSignalTypes, InputSourcePrice, InputTable, InputTableColumn, InputTableOptions, AccountGuid, CurrentInterval, Fee, Leverage, PriceMarket, TradeAmount
--- @param mult_kc number KC MultFactor. Suggestions: Input, InputAccount, InputAccountMarket, InputButton, InputCdlTypes, InputConstant, InputGroupHeader, InputInterval, InputLrTypes, InputMarket, InputMaTypes, InputOptions, InputOrderType, InputPriceSource, InputPriceSourceMarket, InputSignalManagement, InputSignalTypes, InputSourcePrice, InputTable, InputTableColumn, InputTableOptions, AccountGuid, CurrentInterval, Fee, Leverage, PriceMarket, TradeAmount
--- @param ma_type Enum Optional - BB Moving Average Type. Suggestions: InputMaTypes, DemaType, EmaType, KamaType, MamaType, SmaType, T3Type, TemaType, TrimaType, WmaType
--- @param ma_type_kc Enum Optional - KC Moving Average Type. Suggestions: InputMaTypes, DemaType, EmaType, KamaType, MamaType, SmaType, T3Type, TemaType, TrimaType, WmaType
--- @param ma_type_r Enum Optional - Range Moving Average Type. Suggestions: InputMaTypes, DemaType, EmaType, KamaType, MamaType, SmaType, T3Type, TemaType, TrimaType, WmaType
--- @return number[] SQZMOM values. Output Suggestions: BoolToSignal, ConvertSignal, MapSignal, DelaySignal, GetAboveBelowSignal, GetBuySellLevelSignal, GetConsensusSignal, GetCrossOverUnderSignal, GetRemoteSignal, GetSuperSignal, GetThresholdSignal, GetUnanimousSignal, GetWeightedConsensusSignal, IgnoreSignalIf, PositionToBool, ReverseSignal, SaveRemoteSignal, SignalMapper, SignalProperties, SignalToBool, SignalToLog, SignalWeight, UseSignalIf, Plot
--- @overload fun(source: number[], length: number, mult: number, length_kc: number, mult_kc: number): number[]
--- @overload fun(source: number[], length: number, mult: number, length_kc: number, mult_kc: number, ma_type: Enum): number[]
--- @overload fun(source: number[], length: number, mult: number, length_kc: number, mult_kc: number, ma_type: Enum, ma_type_kc: Enum): number[]
--- @overload fun(source: number[], length: number, mult: number, length_kc: number, mult_kc: number, optionalParameters: OptionalParametersOf_CC_SQZMOM_LB_Ext): number[]
function CC_SQZMOM_LB_Ext(source, length, mult, length_kc, mult_kc, ma_type, ma_type_kc, ma_type_r) end

--- Schaff Trend Cycle
--- @param data number[] Source data. Suggestions: ClosePrices, Prices
--- @param depth number STC Depth. Suggestions: Input
Expand Down
10 changes: 10 additions & 0 deletions haas-production/hs.enumerations-margin-mode.def.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- Enumerations Margin Mode

--- Enumeration, returns a cross-margin mode enum. Used with Get-/SetMarginMode() and IsMarginModeSupported()
--- @class CrossMarginMode : Enum
CrossMarginMode = {}

--- Enumeration, returns isolated margin mode enum. Used with Get-/SetMarginMode() and IsMarginModeSupported()
--- @class IsolatedMarginMode : Enum
IsolatedMarginMode = {}

10 changes: 10 additions & 0 deletions haas-production/hs.enumerations-position-mode.def.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- Enumerations Position Mode

--- Enumeration, returns a hedge position mode enum. Used with Get-/SetPositionMode() and IsPositionModeSupported()
--- @class HedgePositionMode : Enum
HedgePositionMode = {}

--- Enumeration, returns a one-way position mode enum. Used with Get-/SetPositionMode() and IsPositionModeSupported()
--- @class OneWayPositionMode : Enum
OneWayPositionMode = {}

16 changes: 0 additions & 16 deletions haas-production/hs.enumerations-trading.def.lua
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
--- Enumerations Trading

--- Enumeration, returns a cross-margin mode enum. Used with Get-/SetMarginMode() and IsMarginModeSupported()
--- @class CrossMarginMode : Enum
CrossMarginMode = {}

--- Enumeration, returns a hedge position mode enum. Used with Get-/SetPositionMode() and IsPositionModeSupported()
--- @class HedgePositionMode : Enum
HedgePositionMode = {}

--- Enumeration, returns isolated margin mode enum. Used with Get-/SetMarginMode() and IsMarginModeSupported()
--- @class IsolatedMarginMode : Enum
IsolatedMarginMode = {}

--- Enumeration, returns a market type enum. Used by MarketType()
--- @class LeverageTrading : Enum
LeverageTrading = {}
Expand All @@ -20,10 +8,6 @@ LeverageTrading = {}
--- @class MarginTrading : Enum
MarginTrading = {}

--- Enumeration, returns a one-way position mode enum. Used with Get-/SetPositionMode() and IsPositionModeSupported()
--- @class OneWayPositionMode : Enum
OneWayPositionMode = {}

--- Enumeration, returns a market type enum. Used by MarketType()
--- @class SpotTrading : Enum
SpotTrading = {}
Expand Down
4 changes: 4 additions & 0 deletions haas-production/hs.machine-learning.def.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
--- @return boolean. Output Suggestions: Or, And, IsTrue, IsFalse, Not, BoolToSignal, IfElse, Switch, IfElseIf, DoBuy, DoLong, DoSell, DoShort, DoExitPosition, DoFlipPosition, DoSignal, PlaceBuyOrder, PlaceSellOrder, PlaceGoLongOrder, PlaceGoShortOrder, PlaceExitLongOrder, PlaceExitShortOrder, PlaceExitPositionOrder, PlaceCancelledOrder
function IsAbnormal(dataset, multiplier) end

--- Looks to the crypto trading news and returns the sentiment of it
--- @return number. Output Suggestions: Equals, IsBiggerOrSmallerThan, IsSmallerThan, IsBiggerThan, Compare, Add, Sum, Sub, Mul, Mult, Div, AddPerc, AddPercentage, SubPerc, SubPercentage, Plot
function NewsSentiment() end

--- Reads the given data and tries to give a forecast
--- @param dataset number[] Dataset. Suggestions: AskPrices, BuyPrices, BidPrices, SellPrices, OpenPrices, HighPrices, LowPrices, ClosePrices, Prices, HLPrices, HLCPrices, OCPrices, HeikenClosePrices, OHLCPrices, GetBodyHighPrices, GetBodyLowPrices
--- @param L number Length of the window on the series for building the trajectory matrix (L). Suggestions: Input
Expand Down
6 changes: 3 additions & 3 deletions haas-production/hs.mathematical.def.lua
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,10 @@ function PercentageChange(input1, input2) end
PI = {}

--- Calculates a specified number/table raised to the specified power number/table.
--- @param input1 number | table First source value(s). Suggestions: Input
--- @param input2 number | table Second source value(s). Suggestions: Input
--- @param value number | table The base value. Suggestions: Input
--- @param power number | table The power value. Suggestions: Input
--- @return number | table Returns a specified number/table raised to the specified power number/table. Output Suggestions: Equals, IsBiggerOrSmallerThan, IsSmallerThan, IsBiggerThan, Compare, Add, Sum, Sub, Mul, Mult, Div, AddPerc, AddPercentage, SubPerc, SubPercentage, Plot
function Pow(input1, input2) end
function Pow(value, power) end

--- The optional parameters of Random.
--- @shape OptionalParametersOf_Random
Expand Down
12 changes: 12 additions & 0 deletions haas-production/hs.memory-helpers.def.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
--- @return void
function Delete(key) end

--- Initialize a file that can be exported later.
--- @param name string Unique name of the file
--- @param headers string[] Header definition
--- @return void
function InitExportData(name, headers) end

--- The optional parameters of Load.
--- @shape OptionalParametersOf_Load
--- @field defaultValue any | nil Default value for when no data is saved on the key. Default is nil.
Expand Down Expand Up @@ -50,3 +56,9 @@ function LogWarning(message) end
--- @return void
function Save(key, value) end

--- Write data to a file that can be exported later. File size is unlimited, use with caution.
--- @param name string Name of the file to write the data to.
--- @param values string[] The values to write to the file. Needs to match the number of headers defined in InitExportData.
--- @return void
function WriteExportData(name, values) end

6 changes: 6 additions & 0 deletions haas-production/hs.position-information.def.lua
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ function LongAmount(market) end
--- @field amount number The amount open in the position. Suggestions: PlaceExitLongOrder, PlaceExitShortOrder, PlaceSellOrder, PlaceBuyOrder
--- @field profit number The realized + unrealized profits. Suggestions: IsBiggerThan, IsSmallerThan
--- @field roi number The ROI based on the used margin and realized + unrealized profits. Suggestions: IsBiggerThan, IsSmallerThan
--- @field openTime number Timestamp (in unix) when the position was opened. Suggestions: IsBiggerThan, IsSmallerThan
--- @field updatedTime number Timestamp (in unix) when the position was last updated. Suggestions: IsBiggerThan, IsSmallerThan
--- @field closeTime number Timestamp (in unix) when the position was closed. If position is still open, value will be 0. Suggestions: IsBiggerThan, IsSmallerThan
--- @field [1] string The position identifier. Suggestions: PlaceExitPositionOrder
--- @field [2] string The market of the position. Suggestions: ClosePrices, Prices, AskPrices, BuyPrices, BidPrices, SellPrices
--- @field [3] boolean Set on true when the direction is long. Suggestions: Or, And, IsTrue, IsFalse, Not, BoolToSignal, IfElse, Switch, IfElseIf, DoBuy, DoLong, DoSell, DoShort, DoExitPosition, DoFlipPosition, DoSignal, PlaceBuyOrder, PlaceSellOrder, PlaceGoLongOrder, PlaceGoShortOrder, PlaceExitLongOrder, PlaceExitShortOrder, PlaceExitPositionOrder, PlaceCancelledOrder
Expand All @@ -164,6 +167,9 @@ function LongAmount(market) end
--- @field [6] number The amount open in the position. Suggestions: PlaceExitLongOrder, PlaceExitShortOrder, PlaceSellOrder, PlaceBuyOrder
--- @field [7] number The realized + unrealized profits. Suggestions: IsBiggerThan, IsSmallerThan
--- @field [8] number The ROI based on the used margin and realized + unrealized profits. Suggestions: IsBiggerThan, IsSmallerThan
--- @field [9] number Timestamp (in unix) when the position was opened. Suggestions: IsBiggerThan, IsSmallerThan
--- @field [10] number Timestamp (in unix) when the position was last updated. Suggestions: IsBiggerThan, IsSmallerThan
--- @field [11] number Timestamp (in unix) when the position was closed. If position is still open, value will be 0. Suggestions: IsBiggerThan, IsSmallerThan

--- The optional parameters of PositionContainer.
--- @shape OptionalParametersOf_PositionContainer
Expand Down
14 changes: 14 additions & 0 deletions haas-production/hs.profit-information.def.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ function GetCurrentROI(direction, market) end
--- @field highestPointInProfit number Highest Point in total PNL. Suggestions: IsBiggerThan, IsSmallerThan, Log, Plot
--- @field lowestPointInProfit number Lowest Point in total PNL. Suggestions: IsBiggerThan, IsSmallerThan, Log, Plot
--- @field totalMarginUsed number Total Margin Used. Suggestions: IsBiggerThan, IsSmallerThan, Log, Plot
--- @field averageMargin number Average Margin used per position. Suggestions: IsBiggerThan, IsSmallerThan, Log, Plot
--- @field averageProfit number Average Profit per position. Suggestions: IsBiggerThan, IsSmallerThan, Log, Plot
--- @field closedPositions number Closed Positions count. Suggestions: IsBiggerThan, IsSmallerThan, Log, Plot
--- @field profitablePositions number Profitable Positions count. Suggestions: IsBiggerThan, IsSmallerThan, Log, Plot
--- @field losingPositions number Losing Positions count. Suggestions: IsBiggerThan, IsSmallerThan, Log, Plot
--- @field executedOrders number Executed Orders count. Suggestions: IsBiggerThan, IsSmallerThan, Log, Plot
--- @field completedOrders number Completed Orders count. Suggestions: IsBiggerThan, IsSmallerThan, Log, Plot
--- @field [1] number Max. DrawDown in percentages. Suggestions: IsBiggerThan, IsSmallerThan, Log, Plot
--- @field [2] number Max. DrawDown in underlying asset. Suggestions: IsBiggerThan, IsSmallerThan, Log, Plot
--- @field [3] number Sharpe Ratio. Suggestions: IsBiggerThan, IsSmallerThan, Log, Plot
Expand All @@ -91,6 +98,13 @@ function GetCurrentROI(direction, market) end
--- @field [16] number Highest Point in total PNL. Suggestions: IsBiggerThan, IsSmallerThan, Log, Plot
--- @field [17] number Lowest Point in total PNL. Suggestions: IsBiggerThan, IsSmallerThan, Log, Plot
--- @field [18] number Total Margin Used. Suggestions: IsBiggerThan, IsSmallerThan, Log, Plot
--- @field [19] number Average Margin used per position. Suggestions: IsBiggerThan, IsSmallerThan, Log, Plot
--- @field [20] number Average Profit per position. Suggestions: IsBiggerThan, IsSmallerThan, Log, Plot
--- @field [21] number Closed Positions count. Suggestions: IsBiggerThan, IsSmallerThan, Log, Plot
--- @field [22] number Profitable Positions count. Suggestions: IsBiggerThan, IsSmallerThan, Log, Plot
--- @field [23] number Losing Positions count. Suggestions: IsBiggerThan, IsSmallerThan, Log, Plot
--- @field [24] number Executed Orders count. Suggestions: IsBiggerThan, IsSmallerThan, Log, Plot
--- @field [25] number Completed Orders count. Suggestions: IsBiggerThan, IsSmallerThan, Log, Plot

--- The optional parameters of GetTradingReport.
--- @shape OptionalParametersOf_GetTradingReport
Expand Down
14 changes: 14 additions & 0 deletions haas-production/hs.wallet.def.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ function Balance(accountId, coin, market) end
--- @overload fun(optionalParameters: OptionalParametersOf_BalanceAmount): number
function BalanceAmount(accountId, coin, market) end

--- The optional parameters of MarginToTradeAmount.
--- @shape OptionalParametersOf_MarginToTradeAmount
--- @field market string | nil The market returned by PriceMarket(), InputAccountMarket() or InputMarket() for example.

--- Convert margin to a trade amount. In spot markets, the margin is anticipated to be in the quote currency (e.g., USDT in BTC/USDT). For leverage markets, the margin is expected to be in the underlying currency.
--- @param price number The price used in the conversion from margin to trade amount. Suggestions: Input
--- @param margin number The margin used to calculate the trade amount. Suggestions: Input
--- @param leverage number Leverage ratio. Use 0 for cross-margin. Suggestions: Input, Leverage
--- @param market string Optional - The market returned by PriceMarket(), InputAccountMarket() or InputMarket() for example. Suggestions: InputAccountMarket, InputMarket, InputPriceSourceMarket, PriceMarket
--- @return number Returns the calculated trade amount based on the margin. Output Suggestions: Equals, IsBiggerOrSmallerThan, IsSmallerThan, IsBiggerThan, Compare, Add, Sum, Sub, Mul, Mult, Div, AddPerc, AddPercentage, SubPerc, SubPercentage, Plot, PlaceBuyOrder, PlaceGoLongOrder, PlaceGoShortOrder
--- @overload fun(price: number, margin: number, leverage: number): number
--- @overload fun(price: number, margin: number, leverage: number, optionalParameters: OptionalParametersOf_MarginToTradeAmount): number
function MarginToTradeAmount(price, margin, leverage, market) end

--- The optional parameters of MaxExitLongAmount.
--- @shape OptionalParametersOf_MaxExitLongAmount
--- @field market string | nil The guid returned by AccountGuid(), InputAccount or InputAccountMarket for example.
Expand Down
Loading

0 comments on commit 296d801

Please sign in to comment.