Not Getting Active orders

import time
import hmac
import hashlib
import requests
import json

Set your API key and secret

‘’'# API endpoint for cancelling orders
base_url = “https://cdn.india.deltaex.org/v2/orders

Function to generate the signature

def generate_signature(api_key, api_secret, params):
query_string = ‘&’.join([f"{key}={value}" for key, value in sorted(params.items())])
return hmac.new(api_secret.encode(), query_string.encode(), hashlib.sha256).hexdigest()

‘’’

Your Delta Exchange API credentials

API_KEY = api_key
API_SECRET = api_secret

Base URL for Delta Exchange API

BASE_URL = “https://api.india.delta.exchange

Function to create the signature

def create_signature(endpoint, params):
params[‘api_key’] = API_KEY
params[‘timestamp’] = str(int(time.time() * 1000))
query_string = ‘&’.join([f"{key}={value}" for key, value in sorted(params.items())])
signature = hmac.new(API_SECRET.encode(‘utf-8’), query_string.encode(‘utf-8’), hashlib.sha256).hexdigest()
return signature

def generate_signature(method, endpoint, payload, api_secret):
timestamp = str(int(time.time()))
signature_data = method + timestamp + endpoint + payload
message = bytes(signature_data, ‘utf-8’)
secret = bytes(api_secret, ‘utf-8’)
hash = hmac.new(secret, message, hashlib.sha256)
return hash.hexdigest(), timestamp

def get_active_orders(api_key, secret_key):
# Generate the current timestamp in Unix time (seconds)
timestamp = str(int(time.time()))

# Define the endpoint and method
method = 'GET'
endpoint = '/v2/orders'

# Parameters for the GET request (to fetch active orders)
params = {
    'status': 'ACTIVE',  # Fetching only active orders
}

# The string to be signed should include: method + timestamp + endpoint
signature_data = f"{method}{timestamp}{endpoint}"

# Generate the signature using HMAC with SHA256
signature = hmac.new(secret_key.encode(), signature_data.encode(), hashlib.sha256).hexdigest()

# Define the URL for the wallet balances endpoint
url = f'https://api.india.delta.exchange{endpoint}'

# Set the headers for the request
headers = {
    'Accept': 'application/json',
    'api-key': api_key,
    'signature': signature,
    'timestamp': timestamp
}

# Send the GET request to the API
response = requests.get(url, headers=headers)

# Check if the response status code is 200 (OK)
if response.status_code == 200:
    # If successful, print the JSON response
    data = response.json()

    print(data)

Function to get active orders

def get_active_orders_1():
endpoint = ‘/v2/orders’
params = {
‘status’: ‘ACTIVE’, # Fetching only active orders
}

# Create signature for the request
params['signature'] = create_signature(endpoint, params)

# Construct full URL
url = BASE_URL + endpoint

# Send GET request to fetch active orders
response = requests.get(url, params=params)

if response.status_code == 200:
    return response.json()  # Return the active orders in JSON format
else:
    print(f"Error: {response.status_code}, {response.text}")
    return None

Fetch and print active orders

active_orders = get_active_orders(api_key,api_secret)
if active_orders:
print(active_orders)

getting below response:
{‘meta’: {‘after’: None, ‘before’: None, ‘limit’: 10, ‘total_count’: 0}, ‘result’: , ‘success’: True}

but an active order was already there…
pls help me in this code, if I’m approaching in right way.

https://docs.delta.exchange/#get-active-orders

This is documentation for getting open orders endpoint.
In the below table for parameters:
‘states’ (not ‘status’) param can have values like - open,pending.
Currently you have sending params = {‘status’: ‘ACTIVE’}.
You can send {‘states’: ‘open’}