Manual workflows and copy-paste integration create multiple risks in financial services firms, from simple transcription errors to out-of-date pricing and risk information. Adding real-time communications and automation to your application streamlines these workflows, improving compliance and efficiency while reducing risk. And this just became a lot easier to do with the integration of Beacon and Symphony.
Symphony offers secure and trusted team collaboration solutions for financial markets, with encrypted, chat-based technology, bots, and automation to improve everyday workflows. Beacon works seamlessly with the Python APIs for Symphony, enabling you to quickly and easily add interactive functionality to your application, such as real-time quotes, click-to-complete forms, automated monitoring and responses in chat rooms, and triggers for human approvals. In this example, I will show you how to add a bot in Beacon that responds to quote requests.
Symphony has entered the chat
We start with the get_bot_client function to connect to the Symphony API, which takes a profile as an argument. In this example I’m using the default profile, but you can define multiple profiles for different roles and security controls. Credentials are stored in Beacon’s secrets management system, so developers do not need to worry about managing them.
client = get_bot_client(profile=’default’)
This reads the configuration details for the specific profile and returns the Symphony bot client.
Next we add the MessagePoster function, which is connected to a specific chat room (in this case ‘demo’) and the defined bot client.
message_poster = MessagePoster(room=’demo’, bot_client=client)
Finally, we invoke the message_poster to post a message. This functionality not only supports basic strings and variables, but also HTML formatting:
and even fully-defined HTML forms:
Below is a screenshot of the chat room with the HTML-formatted “hello chat!” message and the sample HTML form.
This gives you a quick idea of how simple it is to create a Symphony bot within Beacon.
Using Beacon bots for Pricing requests
In the next example, I’ll quickly cover how to make a rules-based Symphony bot that responds to user requests in a channel. Only a few snippets of code are required. For the full details and code examples, check out my video: A Symphony Bot using Beacon
There are a few components to this:
1. Define a rule so that the bot knows when someone is talking to it. In this case, I’m going to use “/quote” for quote requests to the bot, and capture the following part of the string
regex = “^/quote (.+)”
2. Define a response format, which can include the name of the requestor, key parts of the query, and of course the information we are asking about.
def process_match(self, msg, match):
(the full definition for this process is shown in the video)
3. Finally, parse the expression to resolve what is being asked, and return that information to the bot for posting into the chat room. Below is part of the function, and all of this code example is contained in the video.
inst = parse_expr(
Then, to request information on CME Group crude oil futures, I can type in the chat room:
/quote CME CL M21 76C LO
What the user sees is:
For more information
This is a very brief example and just scratches the surface of the power and potential of Beacon/Symphony integration. Many other Beacon features can be integrated with Symphony’s trusted real-time communications engine. A good starting point is a bot that automates trade booking, bots to generate risk and PnL reports, or commands to generate plots and visualizations.