
place_order.py
As I sit around stewing trying to make millions while a computer can do the work for me. As I try and work on accumulating enough BNB to migrate a version of Peakecoin across chains.
This is where I've gotten so far. I'll need to plug all these files in to the Chat GPT for a little debugging once I can get the rest of these things coded. Its all a learning process and I'm going to do all these off of Raspberry Pis.
What we really need here working on the Peakecoin Project is a new computer to set up an actual server for these projects to continue. If anyone else has a server with space up and running that I can use that would be fantastic as well.
File Structure
pekbnbswap/
│-- fetch_market.py
│-- place_order.py
│-- trade_loop.py
│-- hive_trading_bot.py
│-- ftp_upload.py
place_order.py
import time
import requests
HIVE_ENGINE_API = "https://api.hive-engine.com/rpc"
def place_order(account, token, price, quantity, order_type="buy"):
payload = {
"jsonrpc": "2.0",
"method": "broadcast",
"params": {
"contractName": "market",
"contractAction": "buy" if order_type == "buy" else "sell",
"contractPayload": {
"symbol": token,
"quantity": str(quantity),
"price": str(price)
}
}
}
response = requests.post(f"{HIVE_ENGINE_API}/contracts", json=payload)
return response.json() if response.status_code == 200 else None
if __name__ == "__main__":
order_response = place_order("peakecoin.bnb", "SWAP.BNB", 0.99, 5, "buy")
print(order_response)
Description
- place_order.py: Sends buy/sell orders to Hive Engine.
- fetch_market.py: Fetches live market data.
- trade_loop.py: Automates order execution in a loop.
- hive_trading_bot.py: Manages the trading bot.
- ftp_upload.py: Uploads logs and data to an FTP server