Skip to content

Instantly share code, notes, and snippets.

@AWScommunity
Created September 19, 2024 14:59
Show Gist options
  • Save AWScommunity/3391060fd97504427dd8fa74f951dd5c to your computer and use it in GitHub Desktop.
Save AWScommunity/3391060fd97504427dd8fa74f951dd5c to your computer and use it in GitHub Desktop.
autoTrade
#to implement the buying strategies (excluding iceberg orders) using a hypothetical trading API.
#focuses on placing limit buy orders at key support levels, taking advantage of thin order books,
#and executing orders during high-volume periods.
import time
import datetime
import random
class TradingAPI:
def get_order_book(self, symbol):
# Mock function to get the order book
# Replace with actual API call to get order book
return {
'buy': [{'price': 20.21, 'quantity': 100}, {'price': 20.20, 'quantity': 150}],
'sell': [{'price': 20.25, 'quantity': 100}, {'price': 20.30, 'quantity': 150}]
}
def get_market_volume(self, symbol):
# Mock function to get market volume
# Replace with actual API call to get market volume
return random.randint(500, 1000)
def place_limit_order(self, symbol, price, quantity):
# Mock function to place a limit order
# Replace with actual API call to place a limit order
print(f"Placing limit buy order for {symbol} at {price} for {quantity} units")
def identify_support_levels(order_book):
# Mock function to identify support levels
# Replace with actual logic to identify support levels
support_levels = [20.15, 20.10, 20.05]
return support_levels
def place_buy_orders(api, symbol):
# Get the order book
order_book = api.get_order_book(symbol)
# Identify support levels
support_levels = identify_support_levels(order_book)
# Place limit buy orders at identified support levels
for level in support_levels:
api.place_limit_order(symbol, level, 100)
# Check for thin order book and place market orders if needed
if len(order_book['sell']) < 5: # Example condition for thin order book
for sell_order in order_book['sell']:
api.place_limit_order(symbol, sell_order['price'], sell_order['quantity'])
def place_buy_orders_high_volume(api, symbol):
# Get current time
current_time = datetime.datetime.now().time()
# Example high volume periods (market open/close)
high_volume_periods = [(datetime.time(9, 30), datetime.time(10, 30)),
(datetime.time(15, 30), datetime.time(16, 0))]
# Check if current time is within high volume periods
for start, end in high_volume_periods:
if start <= current_time <= end:
# Get the order book
order_book = api.get_order_book(symbol)
# Identify support levels
support_levels = identify_support_levels(order_book)
# Place limit buy orders at identified support levels
for level in support_levels:
api.place_limit_order(symbol, level, 100)
break
if __name__ == "__main__":
api = TradingAPI()
symbol = "XYZ"
# Place buy orders based on support levels and thin order books
place_buy_orders(api, symbol)
# Place buy orders during high volume periods
place_buy_orders_high_volume(api, symbol)
@AWScommunity
Copy link
Author

AWScommunity commented May 17, 2025

36 hr fast from Friday 12pm to Saturday ko madhya raat 12 am MUSTTT - its good Vivek, I've researched.

During that time: Drink plenty of water, and consider electrolytes (sodium, potassium, magnesium); Avoid strenuous workouts; Break your fast gently with light, nutritious food (not processed or heavy meals); if dizzy, extremely fatigued, or unwell, stop the fast.

NOT for pregnant n breastfeeding

if cant adjust 36 hr, then:
Start with shorter fasts (e.g., 16:8 or 24 hours) before attempting 36 hours.
Consider doing a 36-hour fast once a month until your body adjusts.

@AWScommunity
Copy link
Author

image
image

image

@AWScommunity
Copy link
Author

image

@AWScommunity
Copy link
Author

AWScommunity commented May 19, 2025

image

@AWScommunity
Copy link
Author

not needed anyway

image

@AWScommunity
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment