Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Read in trades from emails
#1
Hi,
I need to develop a script which will read in and place trades from emails sent each hour.

The email text is as follows:

1 EURCHF Sell 1.1011
2 EURCAD Sell 1.4594
3 CHFJPY Buy 109.757
4 AUDCHF Sell 0.6853
5 NZDCHF Sell 0.6338

I need to read in the second and 3rd columns and place the trades at the market prices. Each hour the system shoudl open the portfolio with the 5 trades. Each portfolio generated each hour needs to be separately managed. For each porfolio there are 3 simple hard rules:

1) If portfolio reaches loss of 100 pips it is closed and the opposite portfolio is opened (which should be closed after 24 hours from the initial portfolio generation time)
2) If the portfolio does not reach the 100 pips stop-loss it will be closed in 24 hours from portfolio initiation time.

Can you suggest a toolbox for that?

I guess I need the email parser, and then the trade placement toolbox and also the multiple portfolio manager. I guess I also need the trade size manager - lot size should be adapted to account size.
Reply
#2
(Nov-06-2019, 10:43 AM)semantina Wrote: Can you suggest a toolbox for that?

With Python: email (parsing and/or creation), poplib (pop3), imaplib (if emails stay on server), smtplib (if you want to send emails).
The rest is a little bit math + Python data structures. Additionally you may need something to store persistent.
You could use sqlite, pickle, text files or other formats. I use for small amount of data sqlite + SQLAlchemy.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply
#3
(Nov-06-2019, 01:02 PM)DeaD_EyE Wrote:
(Nov-06-2019, 10:43 AM)semantina Wrote: Can you suggest a toolbox for that?

With Python: email (parsing and/or creation), poplib (pop3), imaplib (if emails stay on server), smtplib (if you want to send emails).
The rest is a little bit math + Python data structures. Additionally you may need something to store persistent.
You could use sqlite, pickle, text files or other formats. I use for small amount of data sqlite + SQLAlchemy.

Thank you for your kind reply.....you think none of the ready portfolio management libraries will fit this project?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Read All Emails from Outlook and add the word counts to a DataFrame sanaman_2000 0 1,818 Sep-15-2022, 07:32 AM
Last Post: sanaman_2000
  Sending Emails on Autopilot Gyga_Hawk 3 1,629 Mar-15-2022, 08:20 AM
Last Post: Larz60+
  Mark outlook emails as read using Python! shane88 2 6,451 Feb-24-2022, 11:19 PM
Last Post: Pedroski55
  Trying out the parsing/reading of emails from my outlook cubangt 0 6,053 Jan-12-2022, 08:59 PM
Last Post: cubangt
  reading shared outlook emails zarize 0 2,422 Mar-03-2020, 01:47 PM
Last Post: zarize
  Python Library for Reading POP Emails? bmccollum 1 3,564 Jan-06-2020, 06:37 PM
Last Post: micseydel
  How can I make this Python script add a limit to trades made with API? streetlaw 0 1,986 Oct-12-2018, 11:41 AM
Last Post: streetlaw
  No output for the code to read emails avani9659 6 4,151 Aug-14-2018, 08:30 AM
Last Post: avani9659
  generate trades detail from code bhagwat123 0 2,327 Jul-11-2018, 06:33 AM
Last Post: bhagwat123
  Put specific emails in an Excel/.csv CaptainBlueballs 0 2,372 Feb-25-2018, 10:32 AM
Last Post: CaptainBlueballs

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020