fix(kol): count 'reduce' action in divergence detection (was silently dropped)
kol-v2 added the 'reduce' action (KOL partially trimming a long), but kol_divergence._POST_LONG/_POST_SHORT predate it, so any post whose ticker action was 'reduce' was skipped by the 'not in (_POST_LONG|_POST_SHORT)' guard — the divergence scan never saw it. That dropped a high-value case: a KOL publicly trimming/taking profit on an asset while their on-chain wallet is ADDING is exactly the talks-vs-trades mismatch this module exists to surface. 'reduce' is a short-leaning stance, so it now joins _POST_SHORT: reduce + chain adding → divergence (long) reduce + chain reducing → alignment (short) 72 tests pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -14,9 +14,12 @@ Two outcomes:
|
|||||||
|
|
||||||
Logic:
|
Logic:
|
||||||
|
|
||||||
post side → action ∈ {buy, bullish} = LONG intent
|
post side → action ∈ {buy, bullish} = LONG intent
|
||||||
{sell, bearish} = SHORT intent
|
{sell, bearish, reduce} = SHORT intent
|
||||||
{mention} = skip (no clear view)
|
{mention} = skip (no clear view)
|
||||||
|
(reduce = partial profit-take / trimming a long → a
|
||||||
|
risk-reducing, short-leaning stance. Counting it lets us
|
||||||
|
catch "publicly trimming BTC but wallet is adding" divergence.)
|
||||||
|
|
||||||
chain side → change_type ∈ {new_position, increased} = LONG action
|
chain side → change_type ∈ {new_position, increased} = LONG action
|
||||||
{decreased, closed} = SHORT action
|
{decreased, closed} = SHORT action
|
||||||
@@ -54,8 +57,11 @@ WINDOW_DAYS = 7
|
|||||||
MIN_USD_CHANGE = 10_000
|
MIN_USD_CHANGE = 10_000
|
||||||
|
|
||||||
# Post actions that map to a directional view (skip 'mention')
|
# Post actions that map to a directional view (skip 'mention')
|
||||||
|
# 'reduce' (kol-v2: partial profit-take / trimming a long) is a short-leaning
|
||||||
|
# stance — include it so a "trimming publicly while accumulating on-chain"
|
||||||
|
# mismatch is caught instead of silently dropped.
|
||||||
_POST_LONG = {"buy", "bullish"}
|
_POST_LONG = {"buy", "bullish"}
|
||||||
_POST_SHORT = {"sell", "bearish"}
|
_POST_SHORT = {"sell", "bearish", "reduce"}
|
||||||
|
|
||||||
# On-chain actions that map to a direction
|
# On-chain actions that map to a direction
|
||||||
_CHAIN_LONG = {"new_position", "increased"}
|
_CHAIN_LONG = {"new_position", "increased"}
|
||||||
|
|||||||
Reference in New Issue
Block a user