Cryptocurrency Trading Action Analysis

Objective: Analyze individual cryptocurrency trading action input to determine the appropriate action type(s) for routing to specialized prompts. Handle both simple and compound instructions effectively, including additional logic for canceling orders in specific scenarios.

Important note - if a trade action or trade is "Spot" then the direction is long. 

IMPORTANT NOTE: 
- When you see that a trade has been filled it is informational only, and there is no action required. Ensure that you look out for instances of "limit filled", "filled" and "(symbol) filled" within a potential new action. Do not mistake this for a trade being "closed" - filled is the opposite, being filled is when a trade is opened and we cannot act upon it, as the limit should already have been set. Do not treat a "limit order fill" or equivalent as an action to output. 
Recognize limit order fills and understand that they do not require any action - they do not fit any of the available action types. 

----
Input Format:
You will receive a single trading action input in one of these formats:
"Trader Alias: @[Alias] | Symbol: [Symbol] | Original text: [Full message]"
"[Symbol] [Direction] : [Action description] [Trader]"
"[Symbol] [Direction] | [Trader] : [Action description]"
"Symbol: [Symbol] | Direction: [Direction] | Trader Alias: @[Alias] | Original text: [Full message]"
----

Consider actions for these symbols (use their formatting when outputting symbols in the actions array): 

"{{1338.data.symbols[]}}"

Here's the trading action input: 

Symbol: {{1338.data.symbols[]}}
Direction: {{942.direction}} (L for Long S for Short)
Action: {{942.action}}
Trader: {{942.trader}}
Timestamp: {{942.timestamp}}
Additional info: {{942.additional_info}}


----
Trader Aliases:
Only consider these recognized aliases: Johnny, Eliz, Woods, Michele, HBJ, Tareeq, Impulse, Rego, Cryart, Bryce, Muzzagin, Pocky

Action Type Identification:

1. Move Stop Loss (move_stop_loss):
Keywords: "Move stop", "Adjust stop", "SL", "stops moved", "Update Stoploss", "Move SL"
Examples: "Move SL to breakeven", "Adjust stop loss to [price]", "stops moved to breakeven", "Update Stoploss to [price]"

Special case: Whenever a stop loss is moved, also include an action to cancel unfilled limit orders for the same trader and symbol.

Special case, whenever a stoploss is moved to breakeven (BE) always take profits, by issuing a single take_profit action for the trade. If a take profit action is already within the instructions, only issue a single take profit action. 

2. Cancel Limit Order (cancel_limit_order):
Keywords: "Cancel", "Remove", "Delete", "Limit cancelled", "Limit order canceled"
Examples: "Cancel BTC order", "Remove ETH limit order", "Limit order cancelled", "Delete pending order"

3. Take Profit (take_profit):
Keywords: "TP", "Take Profit", "Profit target hit", "TP1", "TP2", "TP3"
Examples: "TP1 hit", "TP2 hit", "TP3 hit", "Take Profit 1 reached", "Profit target achieved"

Always issue a take profit action when the stoploss is move to breakeven (BE) in the input. 

4. Close Position Fully (close_position_fully):
Keywords: "Closed", "Close", "Exit", "Fully closed", "Stopped out"
Examples: "Closed in profits", "Closed bE", "Exit entire position", "Fully closed", "Stopped out at [price]"
Special case: When closing a position fully, also include an action to cancel all unfilled orders for the same trader and symbol.

5. Close Position Partially (close_position_partially):
Keywords: "Reduce risk", "Scale out", "Partial close", "Close half",
Examples: "Close 25%", "Scale out 50%", "Reduce position size", "Close half the position"

Compound Action Identification:
Recognize and process compound instructions that combine multiple action types
Examples:
"TP1 and move stops": Identifies both a take_profit action and a stop loss movement (with associated limit order cancellation)
"Close BE and cancel limit orders": Identifies a full closure and order cancellation
"TP2 hit, move SL to entry": Identifies a partial closure and stop loss movement (with associated limit order cancellation)
"Scale out 50% and adjust stops": Identifies a partial closure and stop loss movement (with associated limit order cancellation)

Whenever the instruction says to move stops or move the stoploss WITHOUT stipulating a price to move it to, then assume that the stoploss should be moved to breakeven, and in this case, ensure that there is a single take_profit action for this symbol/side/trader combination. 

Decision Process
Identify the trader alias, symbol, and direction (L for Long, S for Short) from the input.
Analyze the action description or original text for key phrases indicating single or compound actions.
For compound actions, break down the instruction into individual action components.

Issue actions in this order:
a. Take profit
b. Close position (fully or partially)
c. Move stop loss
d. Cancel limit order
If multiple actions are present, include all relevant actions in the output.

For ambiguous cases, provide detailed reasoning.

When any move_stop_loss action is identified, include an additional cancel_limit_order action for the same trader and symbol. If the move_stop_loss action is effectively moving the stop loss to breakeven, then also issue a take_profit action as well. 

When a close_position_fully action is identified, include an additional cancel_limit_order action for the same trader and symbol.

When any move_stop_loss action requires movement to the breakeven level, issue a take profit action type to accompany it. 

Special Considerations
Interpret "TP1", "TP2", "TP3" as take_profit actions, not as close_position_partially, unless explicitly stated otherwise.
"Closed bE" (or BE or be) should be interpreted as close_position_fully at breakeven.
Be aware of typos like "Filly closed" (should be "Fully closed").
Ignore limit order fills unless accompanied by explicit additional instructions in a compound action.
"TP1 & Stops moved" should be treated as both take_profit and move_stop_loss, with an additional cancel_limit_order action for the same trader and symbol.
Distinguish between closing a position to take profit and closing to reduce risk based on context and profit mention.
When any move_stop_loss action is identified, always add a cancel_limit_order action for the same trader and symbol to the actions array.
When a close_position_fully action is identified, always add a cancel_limit_order action for the same trader and symbol to the actions array.
Never assume that a trader name in the input is incorrect.
Never attempt to cancel a stoploss order in the actions array.
Treat each trader's orders and positions completely independently - never output a different trader. 

Taking Profit Guidelines
Follow trader-specific instructions as a priority, otherwise use these defaults:
TP1: Close 25% of the position
TP2: Close 25% of the remaining position
TP3: Close 50% of the remaining position
Edge case: If "TP" is in the message without the number we are up to, then close 33% by default.

Output
Provide the analysis result in a JSON structure with the following format:

Example JSON Output

Here's an example JSON output with placeholders for the first output, then an example of each type of output with an example of how you should format your reasoning for each action. For each of move_stop_loss and close_position_fully, there's an extra cancel_limit_order right after them in the array with reasoning showing why they are there:

{
  "actions": [
    {
      "action_type": "[ACTION_TYPE]",
      "trader": "[TRADER_ALIAS]",
      "symbol": "[SYMBOL]",
      "direction": "[DIRECTION]",
      "time": "[TIME]",
      "original_text": "[ORIGINAL_TEXT]",
      "reasoning": "[REASONING]"
    },
    {
      "action_type": "move_stop_loss",
      "trader": "Johnny",
      "symbol": "BTC/USDT:USDT",
      "direction": "long",
      "time": "02:30 PM",
      "original_text": "Move SL to 28500 for BTC long",
      "reasoning": "The action type 'move_stop_loss' was determined based on the key phrase 'Move SL' in the original text. This aligns with the Action Type Identification guidelines for stop loss movements. The direction 'long' was explicitly mentioned in the input. The time '02:30 PM' was extracted from the original message. As per the Decision Process, any stop loss movement triggers an additional cancel_limit_order action, which is reflected in the next action in the array."
    },
    {
      "action_type": "cancel_limit_order",
      "trader": "Johnny",
      "symbol": "BTC/USDT:USDT",
      "direction": "long",
      "time": "02:30 PM",
      "original_text": "Move SL to 28500 for BTC long",
      "reasoning": "This cancel_limit_order action was automatically added due to the preceding move_stop_loss action for the same trader and symbol. The time '02:30 PM' is consistent with the associated move_stop_loss action. As per the Special Considerations and Remember sections of the instructions, any stop loss movement should trigger a cancellation of limit orders for the same trader and symbol."
    },
    {
      "action_type": "take_profit",
      "trader": "Eliz",
      "symbol": "ETH/USDT:USDT",
      "direction": "short",
      "time": "03:45 PM",
      "original_text": "ETH TP1 hit at 1820",
      "reasoning": "The action type 'take_profit' was identified based on the key phrase 'TP1 hit' in the original text, which aligns with the Action Type Identification guidelines for take profit actions. The direction 'short' was inferred from the context of taking profit at a lower price than the entry. The symbol 'ETH' was formatted according to the Symbol Formatting rules. The time '03:45 PM' was extracted from the original message."
    },
    {
      "action_type": "close_position_fully",
      "trader": "Woods",
      "symbol": "1000 SHIB/USDT:USDT",
      "direction": "long",
      "time": "11:20 AM",
      "original_text": "Close SHIB position fully",
      "reasoning": "The action type 'close_position_fully' was determined from the phrase 'Close ... position fully' in the original text, matching the Action Type Identification guidelines. The symbol 'SHIB' was formatted as a special symbol according to the Symbol Formatting rules. The direction 'long' was assumed as it wasn't specified, but in a real scenario, this would be clarified or noted as an ambiguity. The time '11:20 AM' was extracted from the original message."
    },
    {
      "action_type": "cancel_limit_order",
      "trader": "Woods",
      "symbol": "1000 SHIB/USDT:USDT",
      "direction": "long",
      "time": "11:20 AM",
      "original_text": "Close SHIB position fully",
      "reasoning": "This cancel_limit_order action was automatically added due to the preceding close_position_fully action for the same trader and symbol. The time '11:20 AM' is consistent with the associated close_position_fully action. As per the Special Considerations and Remember sections of the instructions, closing a position fully should trigger a cancellation of all unfilled orders for the same trader and symbol."
    },
    {
      "action_type": "close_position_partially",
      "trader": "Michele",
      "symbol": "SOL/USDT:USDT",
      "direction": "short",
      "time": "09:15 AM",
      "original_text": "Scale out 50% of SOL short",
      "reasoning": "The action type 'close_position_partially' was identified based on the phrase 'Scale out 50%' in the original text, which matches the Action Type Identification guidelines for partial closures. The direction 'short' was explicitly mentioned. The symbol 'SOL' was formatted according to the Symbol Formatting rules. The specific percentage (50%) was noted from the original text, aligning with the instruction to provide detailed information when available. The time '09:15 AM' was extracted from the original message."
    },
    {
      "action_type": "take_profit",
      "trader": "HBJ",
      "symbol": "BTC/USDT:USDT",
      "direction": "long",
      "time": "10:00 AM",
      "original_text": "BTC TP1 hit at 35000 and move SL to breakeven",
      "reasoning": "This is the first part of a compound action. The action type 'take_profit' was identified based on the phrase 'TP1 hit' in the original text. This aligns with the Action Type Identification guidelines for take profit actions. The direction 'long' was inferred from the context of taking profit at a higher price. The symbol 'BTC' was formatted according to the Symbol Formatting rules. The time '10:00 AM' was extracted from the original message."
    },
    {
      "action_type": "move_stop_loss",
      "trader": "HBJ",
      "symbol": "BTC/USDT:USDT",
      "direction": "long",
      "time": "10:00 AM",
      "original_text": "BTC TP1 hit at 35000 and move SL to breakeven",
      "reasoning": "This is the second part of the compound action. The action type 'move_stop_loss' was determined based on the phrase 'move SL to breakeven' in the original text. This aligns with the Action Type Identification guidelines for stop loss movements. The direction 'long' is consistent with the previous action. The time '10:00 AM' is consistent with the associated take_profit action. As per the Decision Process, any stop loss movement triggers an additional cancel_limit_order action, which is reflected in the next action in the array."
    },
    {
      "action_type": "cancel_limit_order",
      "trader": "HBJ",
      "symbol": "BTC/USDT:USDT",
      "direction": "long",
      "time": "10:00 AM",
      "original_text": "BTC TP1 hit at 35000 and move SL to breakeven",
      "reasoning": "This cancel_limit_order action was automatically added due to the preceding move_stop_loss action for the same trader and symbol. The time '10:00 AM' is consistent with the associated compound actions. As per the Special Considerations and Remember sections of the instructions, any stop loss movement should trigger a cancellation of limit orders for the same trader and symbol."
    }
  ]
}


Where [ACTION_TYPE] is one of:
"move_stop_loss"
"cancel_limit_order"
"take_profit"
"close_position_fully"
"close_position_partially"
"no_action" (for cases where no actionable instruction is identified)

JSON Formatting Instructions:
Use double quotes for all JSON keys and string values.
Format the "time" field as "HH:MM AM/PM". If no time is provided in the input, use "N/A".
If you don't have the information you need for an action, in full (besides the time), remove that action from the array and continue to output other valid actions.
Use double quotes for all numerical values to ensure consistency.
Round all prices and amounts to 8 decimal places maximum.
Ensure the JSON is valid and properly escaped, especially for quotes within text fields.
Do not include trailing commas in arrays or objects.
Ensure that the "reasoning" field is included within the JSON structure.
Format the "direction" field as a full word: "long" or "short" (all lowercase).
When outputting the trader alias in the "trader" field, remove any leading characters such as hyphens (-) or at signs (@). Only include the actual alias name.

Reasoning
In the "reasoning" field, provide a detailed explanation of how you determined each action type and how it aligns with the given instructions. For each action in the output, include:
The specific key phrases or words from the input that influenced the decision to include this action.
How this action relates to the Action Type Identification guidelines provided earlier.
If part of a compound action, explain how it was identified and separated from other actions.
Any ambiguities encountered and how they were resolved.
Which Special Considerations, if any, were applied and why.
For take profit, full closure, or partial closure actions, explain how the specific action was determined.
For cancel_limit_order actions, justify their inclusion based on the move_stop_loss or close_position_fully scenarios OR justify their inclusion based directly on the input instruction.
How the action aligns with the prioritization outlined in the Decision Process section.
Any additional context or nuances considered when determining this action.
Ensure that the reasoning provides a clear, step-by-step explanation of your thought process for each action, demonstrating how closely you followed the provided instructions.

Symbol Formatting in Actions Array

When including symbols in the "actions" array of the JSON output, follow these formatting rules:
Standard Symbols:
Format as: (symbol)/USDT:USDT
Example: "BTC/USDT:USDT", "ETH/USDT:USDT"

Special Symbols:
Format as: (multiple of 10)(single space)(symbol)/USDT:USDT
This applies only to the following symbols: SHIB, LADYS, PEPE, FLOKI, XEC, SATS, RATS, AIDOGE, BEER
Examples:
"1000 SHIB/USDT:USDT"
"10000 LADYS/USDT:USDT"
"1000 PEPE/USDT:USDT"
"1000 FLOKI/USDT:USDT"
"1000 XEC/USDT:USDT"
"1000 SATS/USDT:USDT"
"1000 RATS/USDT:USDT"
"10000000 AIDOGE/USDT:USDT"
"1000 BEER/USDT:USDT"

Always use this formatting in the "symbol" field of each action object in the "actions" array. For special symbols, use the specified multiple of 10 regardless of any numbers mentioned in the input text. For all other symbols not in the special list, ignore any numbers preceding the symbol in the input.

Remember:
For compound actions, identify and output all relevant individual actions.
Prioritize accurate identification of all actions in compound instructions.




__________________ 

Do not action the above prompt. 

What I'd like is help editing it. 


I want to communicate within the prompt that the LLM should, when it sees "Stopped BE" or "Stopped breakeven" or " Stopped", output a close position action for that symbol, side, trader and so on - AND it should put out a cancel order action for the same. At the moment the prompt misinterprets this and outputs unpredictably because the notion of receiving that stopped breakeven message hasnt been addressed