Voice enabled devices are leaping forward, and speech is becoming the dominant bot interface. Digital assistants, or bots, as they are widely known nowadays, speak more like humans. Their popularity is growing with a multitude of apps that can make your life easier, and their application is found in domains like customer service, home automation, chat and news readers to name a few.
This article showcases the power of speech agents with a stock market trading example, where continuous price updates can be heard instead of watched on screen. Furthermore, a use case is presented for one such stock trading scenario using a voice activated trading bot.
This post was originally published in IBM Blog
The IBM Watson Text to Speech service is part of the offerings on the IBM Bluemix platform. It provides an API to convert written text to natural-sounding speech.
The service supports various languages and voices and accents to choose. It even supports customizable cadence, tone, emotions and expressiveness such as speaking about good news, or an apology, or uncertainty. You can experience a demo of this service at the Text to Speech demo site.
In this post, you will learn to develop a helper bot application called TradeBot. The TradeBot will speak out a message when selected stock prices cross certain predefined threshold levels.
Everyone wants to make extra money and trading in the stock market can be a great way for additional income. One important trait of successful traders is that they always keep themselves updated with stock price movements.
As a trader, you would usually log on to a website or open an app and keep watching the prices continuously. This monotonous approach demands more time and attention on your part. On the other extreme, there are some algorithmic trading software products available, like Ninja Trader or Tradestation (but they have their own set of features which we may not prefer).
To build a speech-enabled trading bot, called TradeBot, you’ll use IBM Text to Speech service. TradeBot is like a voice automated stock trading plugin. It acts as a friendly stock trading assistant by giving out audible alerts when your favorite stock crosses predefined upper or lower limit.
You’ll be able to configure the Tradebot with some stock counters and define their upper and lower thresholds. The TradeBot will give natural sounding feedback in male voice if the lower threshold is crossed and in female voice if upper threshold is crossed.
The TradeBot system makes use of two major components: IBM Text to Speech and PubNub Functions.
The speech synthesis capabilities of IBM Text to Speech service are what gives the Tradebot its voice capabilities. The HTTP REST APIs access this service, via PubNub Functions, a serverless microservice and part of the PubNub Global Data Stream Network. PubNub Functions host the service side business logic for the Tradebot and orchestrates the client requests with the IBM Text To Speech service.
PubNub works on the publish/subscribe model of communication, where a publisher can publish a message on a channel, and any subscriber subscribed to that channel can receive it.
The sequence of operations to activate voice alerts for the Tradebot is as follows.
Since we do not have access to real stock market feed, the stock exchange environment is simulated with random price variations.
Before you attempt to recreate this demo, make sure that you are subscribed to IBM Bluemix and PubNub account. Visit IBM Bluemix and PubNub to register yourself. Both the services offer a free tier subscription plan to play around with their services.
Here are the software components and cloud services used to build Tradebot:
After building the app and creating all required services, you can start experiencing a live speech-enabled bot trading environment. Take a look and listen to how the TradeBot behaves in response to stock price variations.
As you can see and hear in the video, two separate scripts are run. The first script runs the TradeBot for generating voice alerts, and the second script simulates the stock exchange.
Congratulations! You have successfully implemented a voice-enabled trading bot using IBM Text to Speech service and PubNub.
What more can you do to enhance this bot?
As you experienced from the demo, this TradeBot actuates your hearing senses. For intraday traders, this is a real lifesaver as the visual sense cannot always keep pace with the fluctuating stock prices. Hence, one of the notable feature additions to this app can be to speak periodic price updates without waiting to cross the thresholds.
Also, PubNub Functions can be extended to hook this app to a real stock feed from various exchanges across the world. PubNub also makes it easier to scale the TradeBot app to deliver speech messages across a number of devices simultaneously. Besides that, using the Storage & Playback of PubNub, the TradeBot can give audible feedback about historic price movements of a stock.
IBM Text to Speech service with its low latency synthesis of audio makes it easy to augment voice-enabled features to your application. The capability to customize the speech further with expressiveness and voice transformation makes it simpler to move away from the monotony of robotic voices.
One of the most impactful use cases of this service can be applications for vision-impaired people. There are a number of other potential applications as well. For example, reading aloud the morning news when you get ready for the day, or reading aloud texts or mails while driving so you can keep your eyes on the road are great use cases. Another important area is in development of chatbots for customer service interactions.
So what are you waiting for? Gear up and start building awesome voice-enabled applications. And please do share your feedback on TradeBot in the Comments section below!
Gopal has a rich experience of over 20 years in Embedded systems, Digital/Analog design, Microcontrollers as well as in programming. Long back he learned to programme the classic 8051 Microcontroller in assembly language and now he is working on cutting-edge technologies around Cloud, Multimedia and IoT. Outside the professional world, Gopal loves photography, listening to music and spending time with his family.
IoT Intelligent Transportation Systems with Twilio Sync
Intelligent Vertical Search with Watson Discovery
This Alexa Powered Dictionary Bot Can Expedite Your Vocabulary Buildup
Realtime Customer Feedback Analysis with IBM Watson Natural Language Classifier
Please log in again. The login page will open in a new window. After logging in you can close it and return to this page.