Skip to content

Quick Start Guide

Get up and running with Vedicquant SSE signals in under 5 minutes.

🎯 Overview

This guide will help you:

  1. Connect to the SSE stream
  2. Receive your first cosmic signal
  3. Process signal data
  4. Build your first trading integration

🔑 Authentication

For testing and development, use the free week access:

API Key Format: free-week-[anything]
Examples: free-week-demo, free-week-test-123, free-week-mybot

Free Week Access

Any API key starting with free-week- gives you full access during the testing period. No signup required!

🚀 Method 1: Browser/JavaScript

Perfect for web applications, dashboards, and frontend development.

html
<!DOCTYPE html>
<html>
<head>
    <title>Vedicquant SSE Test</title>
</head>
<body>
    <h1>🌙 Cosmic Trading Signals</h1>
    <div id="signals"></div>
    
    <script>
        const eventSource = new EventSource(
            'https://sse.vedicquant.com/api/signals/stream?api_key=free-week-demo'
        );
        
        // Connection established
        eventSource.addEventListener('connection', (event) => {
            const data = JSON.parse(event.data);
            console.log('✅ Connected:', data.message);
            
            document.getElementById('signals').innerHTML = 
                '<p style="color: green;">✅ Connected to cosmic signals stream!</p>';
        });
        
        // New signal received
        eventSource.addEventListener('signal', (event) => {
            const signal = JSON.parse(event.data);
            
            if (signal.event_type === 'new_signal') {
                console.log('🔥 New Signal:', signal);
                
                // Display signal in UI
                const signalHTML = `
                    <div style="border: 1px solid #ddd; padding: 15px; margin: 10px 0; border-radius: 8px;">
                        <h3>🌙 ${signal.symbol} ${signal.signal_type}</h3>
                        <p><strong>Phase:</strong> ${signal.phase_name}</p>
                        <p><strong>Entry:</strong> $${signal.price_at_signal}</p>
                        <p><strong>Target:</strong> $${signal.target_price}</p>
                        <p><strong>Stop Loss:</strong> $${signal.stop_loss_price}</p>
                        <p><strong>Strength:</strong> ${signal.signal_strength}</p>
                        <p><strong>Time:</strong> ${new Date(signal.issued_at).toLocaleString()}</p>
                    </div>
                `;
                
                document.getElementById('signals').innerHTML = signalHTML + 
                    document.getElementById('signals').innerHTML;
            }
        });
        
        // Heartbeat (keep-alive)
        eventSource.addEventListener('heartbeat', (event) => {
            console.log('💓 Heartbeat:', new Date().toLocaleTimeString());
        });
        
        // Connection error
        eventSource.onerror = (error) => {
            console.error('❌ SSE Error:', error);
            document.getElementById('signals').innerHTML = 
                '<p style="color: red;">❌ Connection error - will retry automatically</p>';
        };
    </script>
</body>
</html>

Save as test.html and open in your browser!

🐍 Method 2: Python

Ideal for trading bots, data analysis, and server-side applications.

python
#!/usr/bin/env python3
"""
Vedicquant SSE Client - Python Example
Simple client to receive and process cosmic trading signals
"""

import requests
import json
import time
from datetime import datetime

class VedicquantClient:
    def __init__(self, api_key="free-week-demo"):
        self.api_key = api_key
        self.sse_url = "https://sse.vedicquant.com/api/signals/stream"
        self.headers = {
            'X-API-Key': self.api_key,
            'Accept': 'text/event-stream',
            'Cache-Control': 'no-cache'
        }
    
    def connect(self):
        """Connect to SSE stream and process signals"""
        print(f"🌙 Connecting to Vedicquant SSE...")
        print(f"📡 URL: {self.sse_url}")
        print(f"🔑 API Key: {self.api_key}")
        
        try:
            response = requests.get(
                self.sse_url,
                headers=self.headers,
                stream=True,
                timeout=60
            )
            
            if response.status_code == 200:
                print("✅ Connected to cosmic signals stream!")
                self.process_stream(response)
            else:
                print(f"❌ Connection failed: {response.status_code}")
                print(response.text)
                
        except requests.exceptions.RequestException as e:
            print(f"❌ Connection error: {e}")
    
    def process_stream(self, response):
        """Process incoming SSE events"""
        for line in response.iter_lines():
            if line:
                line = line.decode('utf-8')
                
                # Parse SSE event
                if line.startswith('event: '):
                    event_type = line[7:]
                elif line.startswith('data: '):
                    try:
                        data = json.loads(line[6:])
                        self.handle_event(event_type, data)
                    except json.JSONDecodeError:
                        continue
    
    def handle_event(self, event_type, data):
        """Handle different types of SSE events"""
        timestamp = datetime.now().strftime("%H:%M:%S")
        
        if event_type == 'connection':
            print(f"[{timestamp}] ✅ {data.get('message', 'Connected')}")
            
        elif event_type == 'signal':
            self.handle_signal(data, timestamp)
            
        elif event_type == 'heartbeat':
            print(f"[{timestamp}] 💓 Heartbeat")
            
        else:
            print(f"[{timestamp}] 📡 {event_type}: {data}")
    
    def handle_signal(self, signal, timestamp):
        """Process trading signals"""
        event_type = signal.get('event_type', 'unknown')
        
        if event_type == 'new_signal':
            print(f"\n[{timestamp}] 🔥 NEW COSMIC SIGNAL")
            print(f"Symbol: {signal['symbol']}")
            print(f"Type: {signal['signal_type']}")
            print(f"Strength: {signal['signal_strength']}")
            print(f"Phase: {signal['phase_name']}")
            print(f"Entry: ${signal['price_at_signal']:,.2f}")
            print(f"Target: ${signal['target_price']:,.2f}")
            print(f"Stop: ${signal['stop_loss_price']:,.2f}")
            print(f"Time: {signal['issued_at']}")
            
            # YOUR TRADING LOGIC HERE
            self.execute_signal(signal)
            
        elif event_type == 'signal_closed':
            print(f"\n[{timestamp}] 🔒 SIGNAL CLOSED")
            print(f"Symbol: {signal['symbol']}")
            print(f"Result: {signal['result']}")
            print(f"P&L: {signal.get('profit_loss_percentage', 0):.2f}%")
            
        print("-" * 50)
    
    def execute_signal(self, signal):
        """Implement your trading logic here"""
        print(f"🤖 Processing signal for {signal['symbol']}...")
        
        # Example: Basic signal validation
        if signal['signal_strength'] == 'strong':
            print("💪 Strong signal - consider larger position")
        elif signal['signal_strength'] == 'medium':
            print("👌 Medium signal - standard position")
        else:
            print("⚠️ Weak signal - smaller position or skip")
        
        # Example: Phase-based filtering
        if 'Amrita' in signal['phase_name']:
            print("🌟 Amrita phase - most auspicious timing!")
        elif 'Shubh' in signal['phase_name']:
            print("✨ Shubh phase - good timing")
        
        # YOUR EXCHANGE INTEGRATION HERE
        # self.place_order(signal)

if __name__ == "__main__":
    client = VedicquantClient()
    
    try:
        client.connect()
    except KeyboardInterrupt:
        print("\n👋 Disconnected from cosmic signals stream")

Run it:

bash
python3 vedicquant_client.py

🔧 Method 3: cURL (Testing)

Quick way to test the connection:

bash
# Test the SSE stream
curl -H "X-API-Key: free-week-demo" \
     -H "Accept: text/event-stream" \
     "https://sse.vedicquant.com/api/signals/stream"

# Test server status
curl "https://sse.vedicquant.com/"

🌐 Method 4: React/Next.js

For modern web applications:

jsx
// hooks/useVedicquantSSE.js
import { useState, useEffect } from 'react';

export const useVedicquantSSE = (apiKey = 'free-week-demo') => {
  const [signals, setSignals] = useState([]);
  const [connected, setConnected] = useState(false);
  const [lastHeartbeat, setLastHeartbeat] = useState(null);

  useEffect(() => {
    const eventSource = new EventSource(
      `https://sse.vedicquant.com/api/signals/stream?api_key=${apiKey}`
    );

    eventSource.addEventListener('connection', (event) => {
      const data = JSON.parse(event.data);
      setConnected(true);
      console.log('✅ Vedicquant Connected:', data.message);
    });

    eventSource.addEventListener('signal', (event) => {
      const signal = JSON.parse(event.data);
      if (signal.event_type === 'new_signal') {
        setSignals(prev => [signal, ...prev.slice(0, 9)]); // Keep last 10
      }
    });

    eventSource.addEventListener('heartbeat', (event) => {
      setLastHeartbeat(new Date());
    });

    eventSource.onerror = () => {
      setConnected(false);
    };

    return () => eventSource.close();
  }, [apiKey]);

  return { signals, connected, lastHeartbeat };
};

// components/SignalsDashboard.jsx
import { useVedicquantSSE } from '../hooks/useVedicquantSSE';

export const SignalsDashboard = () => {
  const { signals, connected, lastHeartbeat } = useVedicquantSSE();

  return (
    <div className="p-6">
      <div className="flex items-center gap-2 mb-6">
        <h1 className="text-2xl font-bold">🌙 Cosmic Signals</h1>
        <div className={`px-2 py-1 rounded text-sm ${
          connected ? 'bg-green-100 text-green-800' : 'bg-red-100 text-red-800'
        }`}>
          {connected ? '✅ Connected' : '❌ Disconnected'}
        </div>
      </div>

      {signals.map((signal) => (
        <div key={signal.id} className="border rounded-lg p-4 mb-4 bg-gradient-to-r from-purple-50 to-blue-50">
          <div className="flex justify-between items-start mb-2">
            <h3 className="text-lg font-semibold">
              🔥 {signal.symbol} {signal.signal_type}
            </h3>
            <span className="text-sm text-gray-500">
              {new Date(signal.issued_at).toLocaleString()}
            </span>
          </div>
          
          <div className="grid grid-cols-2 md:grid-cols-4 gap-4 text-sm">
            <div>
              <span className="text-gray-600">Phase:</span>
              <p className="font-medium">{signal.phase_name}</p>
            </div>
            <div>
              <span className="text-gray-600">Entry:</span>
              <p className="font-medium">${signal.price_at_signal?.toLocaleString()}</p>
            </div>
            <div>
              <span className="text-gray-600">Target:</span>
              <p className="font-medium text-green-600">${signal.target_price?.toLocaleString()}</p>
            </div>
            <div>
              <span className="text-gray-600">Stop:</span>
              <p className="font-medium text-red-600">${signal.stop_loss_price?.toLocaleString()}</p>
            </div>
          </div>
        </div>
      ))}
      
      {signals.length === 0 && (
        <div className="text-center py-12 text-gray-500">
          <p>🌙 Waiting for cosmic signals...</p>
          <p className="text-sm mt-2">Signals appear when the cosmos aligns</p>
        </div>
      )}
    </div>
  );
};

🎮 Next Steps

Now that you're connected:

  1. Explore Examples - Complete integrations for different platforms
  2. API Reference - Detailed endpoint documentation
  3. Trading Bots - Automated trading implementations
  4. Notification Bots - Telegram and Discord integrations

🚨 Important Notes

Development vs Production

  • The examples use the production server https://sse.vedicquant.com
  • For production, use https://sse.vedicquant.com
  • Replace free-week-* keys with proper API keys

Signal Frequency

  • Signals are generated based on cosmic timing (Choghadiya phases)
  • Not all phases are favorable for trading
  • Expect 2-8 signals per day depending on market conditions

🆘 Troubleshooting

Connection Issues:

bash
# Check if SSE server is running
curl https://sse.vedicquant.com/

# Test with verbose output
curl -v -H "X-API-Key: free-week-demo" \
     "https://sse.vedicquant.com/api/signals/stream"

No Signals Received:

  • Signals are generated during favorable Vedic phases
  • Check server logs for signal generation
  • Use the test signal endpoint (development only)

Browser CORS Issues:

  • SSE server includes CORS headers
  • For production, configure proper origins

Ready to harness cosmic trading power? 🌙✨

Released under the MIT License.