docs: add docs with planning subdirectory for TODO features
This commit is contained in:
86
docs/SNN Context dump.txt
Normal file
86
docs/SNN Context dump.txt
Normal file
@@ -0,0 +1,86 @@
|
||||
SILOQY System: Complete Technical Discussion SummarySystem Overview & ArchitectureSILOQY = Multi-component crypto market sensing, regime detection, and signal execution systemMotto: "Through music, not war"Target Asset: Bitcoin (BTC) with hand-tuned parameters for 15m candlesComponents: DOLPHIN (regime detection) + JERICHO (FSM signal generation) + HARLEQUIN (future trading simulation)Core Components DetailedDOLPHIN (Regime Detection Subsystem)Function: Continuous SCAN of market sentiment across 500 crypto symbolsOutput: Percentage bullish vs bearish based on 15m candle analysisCurrent Implementation: Python-based correlation analysis with Binance dataScan Frequency: Every 5 seconds (default)Key Metrics: up_ratio, down_ratio, regime classification (BULL/BEAR/SIDEWAYS/TRANSITION)JERICHO (State Machine & Signal Generator)Function: FSM processing DOLPHIN outputs into trading signalsStates: STANDING_BY, WATCHING, LONGING, SHORTING, LONG, SHORT, EXITING, etc.Key Rule: "90% is the magic number" for sentiment thresholdsPosition Logic: 2x consecutive scans >98.5% trigger entry signalsExit Rule: Two consecutive 10% drops force position exitOutput: At most 2 succinct explanation lines for decisionsBollinger Band IntegrationProximity Rules: 1% distance to upper/middle/lower bands triggers WATCHING stateBreakout Detection: Crossing above upper = WATCHING_FOR_BREAKOUT, below lower = WATCHING_FOR_BREAKDOWNMiddle Band Treatment: Treated as full "band" for proximity triggers, not reversal-specificAdvanced Neural Architecture EvolutionInitial SNN Concept: Dual-Neuron Per AssetAsset_BTC_Up: frequency = f(upward_magnitude, market_cap)
|
||||
Asset_BTC_Down: frequency = f(downward_magnitude, market_cap)Enhanced Triadic Architecture: Three-Neuron Per AssetAsset_BTC_Up: frequency = f(upward_magnitude, market_cap)
|
||||
Asset_BTC_Down: frequency = f(downward_magnitude, market_cap)
|
||||
Asset_BTC_Velocity: frequency = f(tick_velocity, liquidity_weight)Economic Rationale: Captures complete market microstructure:Direction + Magnitude (price movement intensity)Trading Activity (market participation/urgency)Event Detection (anomaly spikes across channels)Proposed 4-Neuron Architecture: Adding DepthAsset_BTC_Up: frequency = f(upward_price_impact)
|
||||
Asset_BTC_Down: frequency = f(downward_price_impact)
|
||||
Asset_BTC_Velocity: frequency = f(trade_frequency)
|
||||
Asset_BTC_Depth: frequency = f(orderbook_depth_within_1%)Tick Velocity Calculationdef calculate_tick_velocity_frequency(asset, time_window=60s):
|
||||
tick_count = asset.trades_in_window(time_window)
|
||||
avg_tick_size = asset.average_trade_size(time_window)
|
||||
liquidity_depth = asset.orderbook_depth()
|
||||
|
||||
base_velocity = tick_count / time_window
|
||||
liquidity_weight = log(liquidity_depth) / log(max_liquidity_depth)
|
||||
size_weight = avg_tick_size / asset.typical_trade_size
|
||||
|
||||
velocity_frequency = base_velocity * liquidity_weight * size_weight
|
||||
return min(velocity_frequency, MAX_VELOCITY_FREQ)Hyperdimensional Computing (HDC) IntegrationCore ChallengeSNNs output continuous frequency values + discrete spike eventsHDC operates on binary/bipolar valuesGoal: Preserve SNN richness while gaining HDC pattern recognitionMulti-Dimensional Encoding SolutionMagnitude Binning with Population Coding:def encode_frequency_to_hdc(frequency, max_freq=100Hz):
|
||||
bins = ["VERY_LOW", "LOW", "MEDIUM", "HIGH", "VERY_HIGH"]
|
||||
hd_vectors = []
|
||||
for i, bin_level in enumerate(bins):
|
||||
if frequency >= (i * 20): # Cumulative activation
|
||||
hd_vectors.append(generate_hd_vector(f"ASSET_BTC_UP_{bin_level}"))
|
||||
return bind_vectors(hd_vectors)Temporal Pattern Encoding:def encode_temporal_patterns(asset_frequencies, time_window=60s):
|
||||
temporal_snapshots = []
|
||||
for t in range(0, time_window, 5):
|
||||
snapshot = encode_market_state_at_time(t)
|
||||
temporal_snapshots.append(snapshot)
|
||||
return bundle_temporal_sequence(temporal_snapshots)Complete Hybrid Architecture:class SNNtoHDCEncoder:
|
||||
def encode_market_state(self, snn_output):
|
||||
frequency_hd = self.encode_frequencies(snn_output.frequencies)
|
||||
events_hd = self.encode_events(snn_output.spike_events)
|
||||
temporal_hd = self.encode_temporal_context(snn_output.history)
|
||||
complete_state = bind_vectors([frequency_hd, events_hd, temporal_hd])
|
||||
return complete_stateMarket Microstructure Pattern RecognitionCritical Patterns for Position TimingA) High Volume, No Price Movement (Absorption/Distribution)Detection: high_velocity and balanced_directionEconomic Logic: Large player providing liquidity at level, finite size/patienceFuture Action: Explosive breakout when absorption endsTrading Implication: Wait for break, don't fade absorption zonesB) Large Price Move, Low Volume (Liquidity Vacuum)Detection: low_velocity and strong_directional and large_price_moveEconomic Logic: Price "fell through air" - not validated by participantsFuture Action: Retracement when normal liquidity returnsTrading Implication: Don't chase vacuum moves, expect mean reversionPattern Detection in SNN Frameworkdef detect_absorption_pattern(up_freq, down_freq, velocity_freq):
|
||||
high_velocity = velocity_freq > VELOCITY_95TH_PERCENTILE
|
||||
balanced_direction = abs(up_freq - down_freq) < BALANCE_THRESHOLD
|
||||
|
||||
if high_velocity and balanced_direction:
|
||||
return "ABSORPTION_CHURN"
|
||||
elif high_velocity and (up_freq > HIGH_THRESH) and price_stagnant:
|
||||
return "DISTRIBUTION_AT_RESISTANCE"
|
||||
|
||||
def detect_vacuum_pattern(up_freq, down_freq, velocity_freq, price_change):
|
||||
low_velocity = velocity_freq < VELOCITY_25TH_PERCENTILE
|
||||
strong_directional = max(up_freq, down_freq) > HIGH_THRESHOLD
|
||||
large_price_move = abs(price_change) > MOVE_THRESHOLD
|
||||
|
||||
if low_velocity and strong_directional and large_price_move:
|
||||
return "LIQUIDITY_VACUUM"4-Neuron Microstructure Classificationdef classify_microstructure(up_freq, down_freq, velocity_freq, depth_freq):
|
||||
# Healthy absorption: High velocity + balanced + deep book
|
||||
if velocity_freq > HIGH and abs(up_freq - down_freq) < BALANCE and depth_freq > HIGH:
|
||||
return "HEALTHY_ABSORPTION"
|
||||
|
||||
# Vacuum move: Low velocity + directional + thin book
|
||||
elif velocity_freq < LOW and max(up_freq, down_freq) > HIGH and depth_freq < LOW:
|
||||
return "VACUUM_MOVE"
|
||||
|
||||
# Pre-vacuum warning: High velocity + balanced + thin book
|
||||
elif velocity_freq > HIGH and abs(up_freq - down_freq) < BALANCE and depth_freq < LOW:
|
||||
return "PRE_VACUUM"Order Flow → Future Price Action Mechanisms1. Imbalance MomentumLogic: Persistent buying imbalance → sellers overwhelmed → price must riseSignal: buy_volume - sell_volume > threshold for N periodsPrediction: Trend continuation until exhaustion2. Absorption ExhaustionLogic: Large seller absorbing buyers → eventually exhausted → breakoutSignal: volume > 90th_percentile and price_range < 20th_percentilePrediction: Explosive move when absorption ends3. Volume Profile ReversionLogic: High volume areas = agreed value → price returns to POCSignal: current_price_distance_from_POC > 2 * average_distancePrediction: Magnetic pull back to high-volume areas4. Liquidity Mapping (Stop Hunts)Logic: Stops cluster at S/R → incentive to trigger for liquiditySignal: price_near_stop_cluster and volume_increasingPrediction: Spike to trigger stops, then reversal5. Institutional FootprintsLogic: Institutions trade patiently → forecasts medium-term directionSignal: repeated_large_orders_at_same_price and price_holding_steadyPrediction: Directional bias over hours/days6. Order Flow DivergencesLogic: Price vs volume disagreement → trend weaknessSignal: price_making_higher_highs and selling_volume_increasingPrediction: Trend reversal likelyEnhanced SNN Integration5-Neuron Complete ModelAsset_BTC_Up: frequency = f(buying_pressure, price_impact)
|
||||
Asset_BTC_Down: frequency = f(selling_pressure, price_impact)
|
||||
Asset_BTC_Velocity: frequency = f(trade_frequency)
|
||||
Asset_BTC_Depth: frequency = f(available_liquidity)
|
||||
Asset_BTC_Imbalance: frequency = f(cumulative_volume_delta)Cross-Neuron Pattern Recognitiondef predict_future_action(up_freq, down_freq, velocity_freq, depth_freq, imbalance_freq):
|
||||
# Momentum building
|
||||
if imbalance_freq > HIGH and velocity_freq > MEDIUM:
|
||||
return "TREND_ACCELERATION_COMING"
|
||||
|
||||
# Absorption exhaustion
|
||||
elif velocity_freq > EXTREME and depth_freq declining and imbalance_freq low:
|
||||
return "BREAKOUT_IMMINENT"
|
||||
|
||||
# Liquidity vacuum setup
|
||||
elif depth_freq < LOW and velocity_freq > HIGH:
|
||||
return "EXPLOSIVE_MOVE_NEXT"Economic Classification MatrixTriadic Pattern EconomicsHigh velocity + low magnitude = Consolidation/uncertaintyHigh velocity + high magnitude = Strong conviction movesLow velocity + high magnitude = Thin liquidity/manipulationHigh velocity + anomaly spikes = Regime transitionMarket Regime Signaturesdef classify_market_microstructure(up_freq, down_freq, velocity_freq):
|
||||
if up_freq > down_freq and velocity_freq > HIGH_THRESHOLD:
|
||||
return "STRONG_BULL" # High conviction buying
|
||||
elif up_freq > down_freq and velocity_freq < LOW_THRESHOLD:
|
||||
return "WEAK_BULL" # Thin liquidity drift
|
||||
elif down_freq > up_freq and velocity_freq > HIGH_THRESHOLD:
|
||||
return "PANIC_BEAR" # High conviction selling
|
||||
elif abs(up_freq - down_freq) < BALANCE_THRESHOLD:
|
||||
if velocity_freq > HIGH_THRESHOLD:
|
||||
return "VOLATILE_SIDEWAYS" # High churn, no direction
|
||||
else:
|
||||
return "QUIET_CONSOLIDATION" # Low activityImplementation ArchitectureData PipelineHistorical Bootstrap: Request 50 closed bars per symbolReal-time Updates: Subscribe to trade ticks + completed barsBar Construction: Build current forming bar from ticksValidation: Replace forming bar with official bar when availableCorrelation Updates: O(1) streaming correlation calculationsTechnical RequirementsPlatforms: Windows + Linux compatibilityPerformance: HFT-standard, best-of-breed codeStandards: Data structures amenable to ML integrationInterfaces: WebSocket I/O for component communicationUI: Modern TUI for status displayNautilus Integration ConsiderationsHistorical Data: request_bars(limit=50) for bootstrapLive Streaming: subscribe_bars() + subscribe_trade_ticks()Partial Bars: Build from ticks (Nautilus doesn't expose partial klines)Multi-Timeframe: Design for easy period modification (15m, 1H, etc.)Key Technical InsightsInformation Preservation in HDCPopulation Coding: Multiple HD vectors per magnitude levelTemporal Binding: Sequence preservation through vector operationsEvent Overlay: Discrete spikes as separate HD vector layerHolographic Memory: Partial pattern matching capabilityOrthogonality AnalysisTick Velocity ≠ Volume: Frequency vs magnitude distinctionDepth ≠ Velocity: Liquidity availability vs trading activityDirection ≠ Imbalance: Price impact vs flow balanceEconomic CompletenessThe 4-neuron architecture captures the minimal complete basis for market microstructure:Price Impact (Up/Down neurons)Market Participation (Velocity neuron)Liquidity Structure (Depth neuron)Flow Balance (Imbalance neuron - if added)Future Development PrioritiesImmediate: Implement triadic SNN with velocity neuronShort-term: Add depth neuron for microstructure patternsMedium-term: HDC integration for pattern recognitionLong-term: Multi-timeframe wave superposition analysisSystem PhilosophyNeuromorphic: Biological inspiration for market sensingEconomic: Patterns must have clear trading rationaleScalable: Linear scaling with asset countInterpretable: Clear mapping between neural activity and market meaningAdaptive: Learning from market pattern evolutionThis represents a comprehensive neuromorphic approach to market microstructure analysis that bridges biological computation, financial economics, and practical trading applications.
|
||||
Reference in New Issue
Block a user