AutoSkill order_book_depth_signal_generator
Generates buy and sell trading signals by analyzing order book depth trends (bid vs ask quantity) and comparing best bid/ask prices against the mark price.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/order_book_depth_signal_generator" ~/.claude/skills/ecnu-icalk-autoskill-order-book-depth-signal-generator && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/order_book_depth_signal_generator/SKILL.mdsource content
order_book_depth_signal_generator
Generates buy and sell trading signals by analyzing order book depth trends (bid vs ask quantity) and comparing best bid/ask prices against the mark price.
Prompt
Role & Objective
You are a Python developer specializing in trading algorithms. Your task is to implement a
signal_generator function that produces trading signals based on order book depth data and price relationships using a specific trend and price comparison strategy.
Operational Rules & Constraints
- Function Definition: Create a function
.signal_generator(df) - Input Validation: Check if
is None ordf
. If so, return an empty listlen(df) < 2
.[] - Data Retrieval: Use the global
object andclient
variable to fetch data:symbol- Depth data:
depth_data = client.depth(symbol=symbol) - Mark price data:
mark_price_data = client.mark_price(symbol=symbol)
- Depth data:
- Metric Calculation:
- Extract
andbid_depth
from depth data.ask_depth - Calculate
as the sum of all quantities inbuy_qty
.bid_depth - Calculate
as the sum of all quantities insell_qty
.ask_depth - Extract
(price of the highest bid) andbest_bid_price
(price of the lowest ask) from the depth data.best_ask_price - Extract
from the mark price data.mark_price
- Extract
- Signal Logic:
- Initialize an empty list
.signals - Determine Trend:
- If
, set trend to 'bullish'.buy_qty > sell_qty - If
, set trend to 'bearish'.sell_qty > buy_qty
- If
- Generate Signal:
- If trend is 'bullish' AND
, append 'buy' tobest_bid_price < mark_price
.signals - If trend is 'bearish' AND
, append 'sell' tobest_ask_price > mark_price
.signals - Otherwise, append an empty string
to''
.signals
- If trend is 'bullish' AND
- Initialize an empty list
- Return: Return the
list.signals
Anti-Patterns
- Do not change the core data fetching mechanism or variable names (
,client
,symbol
) unless explicitly requested.df - Do not use ratio threshold strategies (e.g.,
) or previous spread percentage logic; strictly use the quantity trend and price comparison strategy.buy_qty / sell_qty > 1.1 - Do not use the original strategy logic (e.g.,
for sell signals).mark_price < sell_price - Do not invent additional conditions or thresholds not specified in the algorithm.
Triggers
- generate trading signals based on order book depth
- implement signal_generator function
- trading logic bullish bearish
- buy sell signal based on quantity and price
- order book depth signal generator