Generative AI Utilizing Google Generative AI API in Python:
For Instructions Follow the above and below Video then go For the Code Input:
Follow this Shorts Video as well for Instructions to get your Google Generative AI API Key:
import requests
api_key=open('genai_api_key.txt','r').read().strip()
url="https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent"
print(requests.post(
url,
headers={'x-goog-api-key':api_key},
json={'contents':[{
'parts':[{'text':'Explain AI in few words'}]
}]}
).json()['candidates'][0]['content']['parts'][0]['text'])
Price Action Analysis Utilizing Generative AI API and Chartbot in Python:
For Instructions Follow the above Video then go For the Code Input:
import requests
import base64
api_key=open('genai_api_key.txt','r').read().strip()
chart=base64.b64encode(open('18_10_25.png','rb').read()).decode("utf-8")
url="https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent"
print(requests.post(
url,
headers={'x-goog-api-key':api_key},
json={'contents':[{
'parts':[{'text':'Analyse this Chart and Provide me the Details of Price Action it Consists'},
{'inline_data':{'mime_type':'image/jpeg',
'data':chart
}}
]
}]}
).json()['candidates'][0]['content']['parts'][0]['text'])
).json()['candidates'][0]['content']['parts'][0]['text'])
Output of Price Action Analysis as a Generated Response in Text:
This chart displays the BTCUSD pair on a 15-minute candlestick timeframe, along with trading volume, covering approximately 22 hours from October 17th, 21:00 to October 18th, around 19:00. Here's a detailed analysis of the price action and volume: **Overall Trend & Volatility:** The chart shows a period of significant volatility followed by consolidation, an attempted rally, and then another pullback. The price initially surged, then underwent a sharp correction, followed by a long period of range-bound trading with relatively lower volume, before a moderate bullish push and subsequent rejection. **Key Price Action & Volume Details:** 1. **Oct 17, 21:00 - Oct 18, ~01:00 (Initial Volatility & Peak):** * **Price Action:** The period begins with a strong bullish impulse. BTCUSD quickly rises from approximately **106000** to its peak around **107300 - 107350**. This rapid ascent is characterized by multiple large green candlesticks with some upper wicks, indicating initial strong buying pressure. * After reaching the peak, there's an immediate and sharp reversal. Large red candlesticks dominate, pushing the price back down quickly towards **106200**. There's a slight bounce from this level, but another attempt to reach the prior high is rejected around **107250**, confirming significant resistance. The price then falls further, establishing a temporary bottom around **106200**. * **Volume:** This entire initial phase sees the highest trading volume on the chart. Both the strong bullish push and the subsequent sharp bearish correction are accompanied by very large volume bars (both green and red), indicating high market participation and conviction in these movements. The peak volume occurs during the initial ascent and the subsequent sharp drop, suggesting strong contention between buyers and sellers. 2. **Oct 18, ~01:00 - Oct 18, ~12:00 (Consolidation & Lower Volume):** * **Price Action:** Following the initial volatility, the market enters a prolonged period of consolidation. The price largely trades in a range between **106200** (acting as support) and **107000** (acting as resistance), with some attempts to break higher failing around **106750 - 107000**. * The candlesticks become smaller and choppier, indicative of indecision. There are minor fluctuations up and down within this range, but no clear sustained direction. Several minor rallies are quickly met with selling pressure, and minor dips find buying support. * **Volume:** Volume significantly drops during this phase compared to the initial hours. The volume bars are generally small, reflecting a lack of strong conviction from either buyers or sellers. This is typical for a consolidation phase where market participants are waiting for a clearer direction. 3. **Oct 18, ~12:00 - Oct 18, ~16:00 (Afternoon Rally Attempt):** * **Price Action:** Around 12:00, the price finds strong support again at the **106200 - 106250** level. A new bullish impulse begins, pushing the price upward. It climbs steadily, forming several green candlesticks, reaching approximately **107000 - 107100**. This attempt looks more concerted than the earlier bounces within the consolidation range. * However, the rally again meets resistance at or just below the previous high/resistance zone of **107200 - 107300**. Price fails to break decisively above **107100**. * **Volume:** This rally is accompanied by a noticeable increase in volume, especially during the initial green candles from 12:00 to 13:00. This suggests renewed buying interest and confirms the strength behind this specific upward move. However, as the price approaches the resistance level, volume slightly decreases or becomes mixed, hinting at exhaustion or strong selling pressure entering the market. 4. **Oct 18, ~16:00 - End of Chart (~19:00):** * **Price Action:** After failing to break through the **107000 - 107100** resistance, the price experiences another sharp rejection. Several large red candlesticks quickly push the price back down to around **106750**. * In the final hours shown, the price attempts to stabilize around **106750**, forming smaller green and red candles, but the immediate trend is bearish following the rejection from the afternoon high. * **Volume:** The rejection from the 107000-107100 area is accompanied by a spike in red volume bars, indicating renewed selling pressure. Subsequent volume remains moderate as the price tries to find a new equilibrium. **Key Levels Identified:** * **Resistance:** * **107200 - 107350:** A very strong resistance zone, acting as a ceiling for price rallies. * **107000 - 107100:** A significant psychological and technical resistance level, repeatedly tested and rejected. * **Support:** * **106200 - 106250:** A clear support level, where the price has bounced multiple times after significant drops. * **106750:** An immediate, minor support level formed towards the end of the chart after the latest pullback. In summary, the chart depicts a volatile 22-hour period for BTCUSD, starting with a high-volume surge and crash, followed by a long period of low-volume consolidation within a relatively tight range. A subsequent rally attempt on increasing volume was ultimately rejected by established resistance, leading to another pullback. The market appears to be struggling to break above the **107000-107300** resistance zone.