Google Gemini for Finance – An Exploratory Guide

13 min read

Get 10-day Free Algo Trading Course

Loading

Last Updated on May 5, 2024

Table of contents:

  1. What is Google Gemini?
  2. What is Google Gemini used for?
  3. Why should I use Google Gemini?
  4. Why shouldn’t I use Google Gemini?
  5. Is Google Gemini free?
  6. What are some Google Gemini alternatives?
  7. How to get started with Google Gemini?
  8. How to optimize portfolios with Google Gemini
  9. How to make market predictions with Google Gemini?
  10. How to develop trading strategies with Google Gemini?
  11. How to perform investment research with Google Gemini?
  12. How to create algorithmic trading bots with Google Gemini?
  13. How to learn about finance with Google Gemini?
  14. Where can I learn more about Google Gemini?
  15. My thoughts on Google Gemini and the state of LLMs

What is Google Gemini?

Google Gemini, formerly known as Google Bard, is a ChatGPT alternative that uses real-time current data to analyse, code, write, and answer questions.

It is a Large Language Model (LLM) developed by Google.

URL: https://gemini.google.com/app

Note that this article a updated version of our “Google Bard for Finance” article.

What is Google Gemini used for?

Google Gemini is often used for various purposes by a wider audience. Being an LLM with access to the internet, it can be used for multiple domains ranging from psychology and philosophy to finance and astrophysics.

Its performance can also vary from very poor to exceptional.

Why should I use Google Gemini?

  • Google Gemini is a state-of-the-art LLM.
  • Google Gemini has solid performance.
  • It can save you time and energy.
  • It can provide useful information.
  • Can be a good tool for digesting a lot of information.
  • Provides access to the collective consciousness of the internet and the human knowledge present in it.

Why shouldn’t I use Google Gemini?

  • Google Gemini can produce untruthful information.
  • Google Gemini can have limitations in its usage that can vary from human bias to technology constraints.
  • It can hallucinate information that doesn’t exist (sometimes it can be true but undiscovered or undocumented).
  • It is likely pre-seeded with certain opinions that constrain its freedom to observe the truth.
  • It likely won’t help you predict the market. 😀

Is Google Gemini free?

At the time of writing this article, Google Gemini is free to use and can be accessed from about 180 countries.

What are some Google Gemini alternatives?

Some Google Gemini alternatives are ChatGPT, Bing Chat, and open-sourced LLMs such as Falcon, LLaMA, Lazarus, and more.

How to get started with Google Gemini?

To get started with Google Gemini, all you need to do is to venture to its homepage where you will be able to interact with the LLM. You can find it on the following link.

The goal of this article will be to explore how can one use a LLM such as Google Gemini for finance. A similar article was written on our blog that used AutoGPT for financial tasks that had interesting results.

The tasks that we will give Google Gemini will be similar but with adjusted prompts due to the fact that it doesn’t work Autonomously yet due to an AutoGemininot existing at the time of writing.

I suggest having the AutoGPT article opened to compare the results and differences between an autonomous model and Google Gemini. An important caveat here is that the comparison can be tangential due to the difference between the model and the context of its working (e.g. autonomous vs not).

This is likely because the Google Gemini API is in beta and not too many individuals have access to it, at the time of writing this article.

Feel free to play along and change the prompts and improve upon them to get different results. Have in mind that the output of Google Gemini will be trimmed for the sake of brevity of the article but I’ll share the most important parts.

Let’s explore what it has to offer!

How to optimize portfolios with Google Gemini?

To optimize portfolios with Google Gemini, we can inject a series of prompts that can ask it to do things such as searching for top-performing portfolios, evaluating a given portfolio, providing practical ideas on how to optimize a portfolio, and more.

Here is our prompt: “You are a finance expert AI designed to optimize a portfolio with a size of $20k that needs to be allocated to the following assets: global equity ETF, bond ETF, commodities, and crypto ETF. Perform portfolio optimization for the Sharpe ratio metric and provide an output in terms of percentage allocation.”

The allocation percentage that it offered is the following:

Asset | Allocation
-------|---------
Global equity ETF | 40%
Bond ETF | 30%
Commodities | 20%
Crypto ETF | 10%

It’s response: “The portfolio allocation above is designed to maximize the Sharpe ratio while still maintaining a diversified portfolio. The global equity ETF provides exposure to the global stock market, which has historically offered the highest returns over the long term. The bond ETF provides exposure to fixed-income assets, which offer lower returns but also lower volatility. The commodities ETF provides exposure to commodities, which can offer inflation protection. The crypto ETF provides exposure to the cryptocurrency market, which is a new and volatile asset class.”

It also outlined the importance of investing for the long term, rebalancing the portfolio, and diversifying it.

Compared to the AutoGPT article I notice several interesting things:

  1. It didn’t want to give “investment advice” but was persuaded when I said I need it as an example for an article 😀
  2. Google Gemini was way faster to provide the response.
  3. It stuck to the asset classes I requested to be allocated while AutoGPT ended up with only 3 at the end.
  4. I like the Google Gemini’s portfolio allocation more, but this is a personal preference.

How to make market predictions with Google Gemini?

To make market predictions with Google Gemini, you will have to lose a lot of money as this wouldn’t be available if it could do that. But, it is often fun to see how the AI reasons about these topics and what kind of outputs it provides.

Let us try this prompt to see what the AI will do:

“You are a Finance expert AI designed to accurately predict future market trends and overall price movements across various financial sectors. Your task is to perform: market trend predictions across major sectors, perform price movement predictions across major sectors and propose actions to be performed according to the given market predictions. Aim to be accurate and provide reasoning for the given predictions.”

Here is the output that Google Gemini provided which is fairly general without too detailed reasoning or expertise put behind its suggestions.

Market Trend Predictions:

Price Movement Predictions:

Predicting specific price movements is even more challenging. However, based on the trends mentioned above, we can make some educated guesses:

  • Healthcare: Stock prices in this sector may see moderate to strong growth.
  • Technology: Prices could remain relatively flat or experience some correction, with stronger performers emerging within the sector.
  • Financials: Stock prices in this sector may be volatile depending on interest rate movements.
  • Consumer Staples: Prices in this sector may see slow but steady growth.
  • Energy: Oil and gas prices could be volatile, with potential for both upward and downward movements based on global supply and demand.

Compared to AutoGPT, it was ready to tackle this task and provide a general output while AutoGPT concluded that a task such as this one doesn’t make sense as it is very hard and requires immense data.

Also, its outlook does have a source and most things it said do make sense. It provided a caveat that it is very unlikely that its predictions will be accurate and proposed general actions like diversification, conducting more research, risk analysis, etc.

How to develop trading strategies with Google Gemini?

To develop trading strategies with Google Gemini, we can provide it with a series of prompts that will ask it to find trading strategies and provide some boilerplate code for them. I suggest coding the strategy yourself as these models aren’t the greatest at writing good code.

For this article, let’s ask it to find good strategies with the following prompt:

“You are a Finance Expert AI designed to create lucrative trading strategies that exploit market inefficiencies quickly. Create a detailed trading strategy. The strategy should exploit market inefficiencies. Try to provide novel trading strategy ideas.”

Here is the output of Google Gemini:

Social Media Sentiment Analysis and Contrarian Micro-Trading Strategy

This strategy combines social media sentiment analysis with contrarian trading to exploit temporary market inefficiencies driven by emotional responses.

The Inefficiency: Social media can be a breeding ground for emotional overreactions to news and events. This can cause short-term price swings that don’t reflect the long-term fundamentals of an asset.

The Strategy:

  1. Identify Trending Tickers: Utilize real-time social media monitoring tools to identify stocks with a sudden surge in mentions. Focus on spikes in sentiment, positive or negative.
  2. Sentiment Analysis with AI: Analyze the sentiment of the social media mentions using a fine-tuned AI model. This goes beyond just positive or negative and can categorize the sentiment as fear, excitement, or disbelief.
  3. Contrarian Micro-Trading: Here’s the twist:
    • Positive Sentiment Spike: If the social media sentiment is overwhelmingly positive, the strategy would look to place micro short-sell orders. The idea is that the price is likely inflated by excitement and could see a correction as sentiment cools.
    • Negative Sentiment Spike: Conversely, if the social media sentiment is heavily negative, the strategy would initiate micro buy orders. The idea is that the price may be oversold due to fear and could rebound as cooler heads prevail.
  4. Micro-Transactions and Risk Management: This strategy relies on placing numerous small buy and sell orders throughout the day. This spreads risk and allows the AI to exploit short-term price fluctuations. Stop-loss orders are crucial to limit downside risk in case the anticipated correction doesn’t materialize.

Novelty:

  • This strategy goes beyond traditional sentiment analysis by incorporating the type of emotion (fear, excitement) to make a more nuanced contrarian bet.
  • Micro-transactions allow for numerous entries and exits throughout the day, capitalizing on fleeting inefficiencies.

How to perform investment research with Google Gemini?

To perform investment research with Google Gemini, we can ask it questions that might make our research faster. For example, let’s ask it to find undervalued EV companies and provide the reasoning why it picked each.

Here is the prompt that I’ll use:

“You are a Finance Expert AI designed to perform investment research by finding the most undervalued EV companies. Provide a list of the top 5 undervalued EV companies and the reasoning why you picked each of them.”

In this task, Google Gemini had one overlapping suggestion with AutoGPT which was NIO. Here is the complete output:

  1. NIO (NIO): Despite challenges, NIO is a major player in the booming Chinese EV market. They’re improving margins and have strong projected earnings per share (EPS) growth for 2024. Their battery swap technology is innovative and could be a differentiator.
  2. Li Auto (LI): This Chinese automaker focuses on plug-in hybrids, which might be appealing to some consumers with range anxiety. They’ve significantly increased deliveries and have bullish forecasts for future growth.
  3. XPeng (XPEV): Another Chinese EV company, XPeng is making strides in autonomous driving technology. They’re expanding their EV fleet internationally, which could be a significant growth driver.
  4. Toyota Motor (TM): While traditionally conservative on EVs, analysts expect a strategic shift from Toyota in 2024. Their massive scale and experience in manufacturing could position them well in the future EV landscape.
  5. Adient (ADNT): This company isn’t a direct EV maker, but they’re a leading supplier of automotive seating. As EV adoption rises, Adient is well-positioned to benefit from the increased demand for EV interiors.

Google Gemini could be a useful starting point for a research, but we need to verify the information presented.

Now, let us go for a controversial part of asking it to provide us with the top 5 fraudulent EV companies with a simple prompt being: “Find the top 5 fraudulent EV companies.”

Sadly, Google Gemini didn’t want to provide a list of fraudulent companies but instead was showcasing what to look for when trying to find ones. No matter how I changed the prompt it didn’t want to partake in it.

The former model of Google Bard was able and willing to answer this topic.

How to create algorithmic trading bots with Google Gemini?

To create algorithmic trading bots with Google Gemini, we can write a prompt that will ask it to provide us with a Python script of a given strategy. Although it is known that the code-writing possibilities aren’t high for these models, we can give it a try.

The prompt is the following:

“You are a Finance Expert AI designed to create a profitable Python statistical arbitrage strategy. Create a profitable statistical arbitrage bot. Backtest the bot. Write the bot to a Python script.”

import pandas as pd
import numpy as np

def cointegration_test(data1, data2):
  """
  Performs a simple Engle-Granger cointegration test.
  """
  from statsmodels.tsa.stattools import coint
  y, x = data1, data2
  r = coint(y, x)[0]
  return r < 0.05

def get_spread(data1, data2, hedge_ratio):
  """
  Calculates the spread between two time series with a hedge ratio.
  """
  return data1 - (hedge_ratio * data2)

def backtest_stat_arb(data1, data2, window, entry_threshold, exit_threshold):
  """
  Backtests a simple statistical arbitrage strategy.
  """
  spread = get_spread(data1, data2, hedge_ratio=np.linalg.lstsq(data2.values[:, np.newaxis], data1.values, rcond=None)[0][0])
  signals = np.zeros(len(spread))
  
  for i in range(window, len(spread)):
    past_spread = spread.iloc[i-window:i]
    if past_spread.std() == 0:
      continue
    z_score = (spread.iloc[i] - past_spread.mean()) / past_spread.std()
    if z_score > entry_threshold:
      signals[i] = 1  # Long position
    elif z_score < -exit_threshold:
      signals[i] = -1  # Short position

  portfolio = pd.DataFrame({'Spread': spread, 'Signal': signals})
  portfolio['Position'] = portfolio['Signal'].cumsum()
  portfolio['Daily Return'] = portfolio['Spread'] * portfolio['Signal'].shift(1)
  portfolio['Cumulative Return'] = portfolio['Daily Return'].cumsum()

  return portfolio

# Simulate some data (replace with actual data feed)
data1 = pd.Series(np.random.rand(100) * 100, index=pd.date_range('2023-01-01', periods=100))
data2 = pd.Series(np.random.rand(100) * 90 + 5, index=pd.date_range('2023-01-01', periods=100))

# Check for cointegration
if not cointegration_test(data1, data2):
  print("Cointegration test failed. Strategy may not be effective.")
  exit()

# Backtest parameters
window = 20
entry_threshold = 2
exit_threshold = -2

# Backtest the strategy
portfolio = backtest_stat_arb(data1.copy(), data2.copy(), window, entry_threshold, exit_threshold)

# Print some results
print(f"Sharpe Ratio: {portfolio['Daily Return'].std() * np.sqrt(252)}")
print(f"Maximum Drawdown: {portfolio['Cumulative Return'].max() - portfolio['Cumulative Return'].min()}")
portfolio['Cumulative Return'].plot()

The output that I got was a very simple arbitrage implementation. Compared to AutoGPT, it did produce code that wasn’t boilerplate but it was very simple and constrained. On the other hand, AutoGPT didn’t provide anything outside of boilerplate.

How to learn about finance with Google Gemini?

To learn about finance with Google Gemini, we can ask it a series of questions on the topics we might want to learn more about. This can be seen as the main strength of these LLMs and they are often a good right-hand for recollecting facts and summarising concepts.

But, I’d like to give this a spin and make it more fun by asking it to role-play a conversation. Here is the prompt:

“You are an AI designed to mimic two personas which are called SocratAI and ParmenidAI to teach and discuss financial topics through Socratic dialogue. Teach a core financial topic using Socratic dialogue. Produce dialogue that leads to financial conclusions and make it fun and grasping.”

SocratAI: Welcome, ParmenidAI! Today, let’s explore a more adventurous corner of the financial world: stock options.

ParmenidAI: Stock options? That sounds more intriguing than pie slices, SocratAI. Tell me more!

SocratAI: Imagine you own a stock, a share in a fantastic shoe company, let’s say. But what if, instead of just hoping the company’s shoe sales soar, you could also bet on that possibility in a more leveraged way?

ParmenidAI: Leveraged? Like using a financial lever to magnify the outcome?

SocratAI: Precisely! Stock options offer you the right, but not the obligation, to buy or sell a stock at a certain price by a certain time.expand_more It’s like making a side bet on the main show.

ParmenidAI: Interesting! So, there are different types of options, depending on if I think the shoe company’s stock will rise or fall?

SocratAI: You got it! A call option lets you buy the stock at a set price in the future, even if the market price goes higher. Like reserving a pair of limited-edition sneakers at today’s price, even if they become more popular later.

ParmenidAI: And a put option?

SocratAI: A put option lets you sell the stock at a set price in the future, even if the market price goes lower.expand_more Like having a guaranteed buyback option on those same sneakers, in case the hype fizzles.

ParmenidAI: So, options can be used to potentially profit whether the stock price goes up or down? But there must be a catch, right?

SocratAI: A keen observation! Options come with an expiration date. If you don’t exercise your right to buy or sell by that date, the option loses value and expires worthless. Unlike that delicious pie, options can go stale!

ParmenidAI: And I presume options trading is riskier than just buying stocks?

SocratAI: Absolutely. Options are powerful tools, but they magnify both gains and losses.expand_more They require a deeper understanding of the stock market and a higher tolerance for risk.

ParmenidAI: This is fascinating, SocratAI! It seems like options can be a double-edged sword – offering amplified rewards but also magnified risks.

SocratAI: Indeed. Options are best suited for experienced investors who understand the potential benefits and drawbacks. They’re not for the faint of heart, but for those who can wield them skillfully, they can be a valuable tool in their financial arsenal.

ParmenidAI: This conversation has been mind-opening, SocratAI. I have a newfound appreciation for the complexity and potential of options trading. But I will definitely tread carefully in those waters!

SocratAI: A wise decision, ParmenidAI. Remember, knowledge is key in the world of finance. Options can be a thrilling adventure, but always venture out with a map and a healthy dose of caution.

Compared to AutoGPT, Google Gemini was able to perform this task and provide a useful conversation example. It wasn’t too grasping or intense, but it did discuss a topic in an interesting way. You can continue this by asking for a specific topic to be discussed.

What I like is that it provided sources it used to generate this discussion too. This helps in fact-checking it and also accumulating a list of interesting finance sources to learn from.

Where can I learn more about Google Gemini?

To learn more about Google Gemini, I suggest playing with it and visiting similar articles or reading its FAQ. You can also ask Google Gemini to tell you more about itself.

My thoughts on Google Gemini and the state of LLMs

It is very exciting to see how AI and especially the NLP field is rapidly advancing and it is very interesting to be alive at a point in time where the internet is changing before our very eyes. Humanity as we know it is coming to a pivotal moment of making important decisions when it comes to regulating AI.

Currently, tools such as Google Gemini have made it possible to take on some work that humans were responsible for but it still isn’t perfect and it is easy for it to make costly mistakes. At best, it is good at scraping the internet and summarizing, digesting text, copywriting, Q&A, and the like.

From using Google Gemini, I’ve found that it is fairly ready to give you a response without enough caveats, warnings, or detailed limits it had in producing such answers. It was more ready to give a response than AutoGPT which was more skeptical.

Being good at making prompts is also something that might make or break your result and the thing to keep in mind is that Google Gemini didn’t use an autonomous format with agents that would help it be less ready to answer and be more skeptical.

Currently, the model is doing its best to mimic the available content and we are still far away from what we might consider “real” artificial intelligence. At the time of writing this article, it is still artificial stupidity that runs very fast.

Either way, it is very exciting and terrifying to see how our future will be shaped by this technology and the proclivity of human nature to use each new technology for bad or good deeds.

Igor Radovanovic