Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #76105 > unrolled thread

Python in financial services

Started byRustom Mody <rustompmody@gmail.com>
First post2014-08-12 00:33 -0700
Last post2014-08-20 00:00 +0100
Articles 12 — 8 participants

Back to article view | Back to comp.lang.python


Contents

  Python in financial services Rustom Mody <rustompmody@gmail.com> - 2014-08-12 00:33 -0700
    Re: Python in financial services Johann Hibschman <jhibschman@gmail.com> - 2014-08-12 11:35 -0400
      Re: Python in financial services Rustom Mody <rustompmody@gmail.com> - 2014-08-12 10:44 -0700
    Re: Python in financial services Denis McMahon <denismfmcmahon@gmail.com> - 2014-08-12 15:50 +0000
      Re: Python in financial services Rustom Mody <rustompmody@gmail.com> - 2014-08-12 10:48 -0700
        Re: Python in financial services Denis McMahon <denismfmcmahon@gmail.com> - 2014-08-12 18:54 +0000
          Re: Python in financial services Rustom Mody <rustompmody@gmail.com> - 2014-08-12 12:05 -0700
    Re: Python in financial services Larry Martell <larry.martell@gmail.com> - 2014-08-12 17:07 -0400
    Re: Python in financial services wxjmfauth@gmail.com - 2014-08-12 23:43 -0700
      Re: Python in financial services Laurent Pointal <laurent.pointal@laposte.net> - 2014-08-19 18:35 +0200
        Re: Python in financial services Terry Reedy <tjreedy@udel.edu> - 2014-08-19 17:59 -0400
        Re: Python in financial services Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-20 00:00 +0100

#76105 — Python in financial services

FromRustom Mody <rustompmody@gmail.com>
Date2014-08-12 00:33 -0700
SubjectPython in financial services
Message-ID<d61fbee7-4404-4924-8793-4e65c15e81be@googlegroups.com>
Ive been asked to formulate a python course for financial services folk.

If I actually knew about the subject, I'd have fatter pockets!
Anyway heres some thoughts. What I am missing out?

[Apart from basic python -- contents typically needs tailoring to the audience] the following:

- Libraries -- Decimal?
- scripts -- philosophy and infrastructure eg argparse, os.path
- Pandas
- Numpy Scipy (which? how much?)
- ipython + matplotlib + ??
- Database interfacing
- Excel interfacing (couple of libraries.. which?)
- C(C++?) interfacing paradigms -- ranging from ctypes, cython to classic lo-level

[toc] | [next] | [standalone]


#76119

FromJohann Hibschman <jhibschman@gmail.com>
Date2014-08-12 11:35 -0400
Message-ID<osxlhqtpvov.fsf@gmail.com>
In reply to#76105
Rustom Mody <rustompmody@gmail.com> writes:

> Ive been asked to formulate a python course for financial services
> folk.
>
> If I actually knew about the subject, I'd have fatter pockets!
> Anyway heres some thoughts. What I am missing out?

Good luck!  It's a pretty broad field, so everyone probably has
different needs.

> - Libraries -- Decimal?

I've never seen decimal used, even though it makes sense for
accounting-style finance.  I've mostly been looking at forecasts,
trading, and risk, where floats are fine.  So maybe mention that it
exists, so people know where to look if they need it, but don't stress
it.

> - scripts -- philosophy and infrastructure eg argparse, os.path

Basic argparse is very handy, but, again, I wouldn't spend too much time
on it.

> - Pandas
> - Numpy Scipy (which? how much?)

For me, pandas is huge, numpy is a nice fundamental substrate, while
only bits and pieces of scipy are used (mostly optimization).
statsmodels may also be worth a mention, as the answer to "how do I do a
regression".

> - ipython + matplotlib + ??

Ipython notebook + matplotlib is great.  At least show that it exists.
pandas plots may be enough, though.

> - Database interfacing

Definitely mention.

> - Excel interfacing (couple of libraries.. which?)

Meh, maybe.  At least give a strategy.  It always seems like a fool's
errand, though: I end up just dumping data to CSV and using that.

> - C(C++?) interfacing paradigms -- ranging from ctypes, cython to
>   classic lo-level

Probably not, but it depends on the audience.  The overview, like
"ctypes will link to C-like libraries, cython lets you write python-like
code that runs fast, and there's SWIG and Boost.Python if you want to
write your own modules" is about all you need.

Hope that helps,
Johann

[toc] | [prev] | [next] | [standalone]


#76126

FromRustom Mody <rustompmody@gmail.com>
Date2014-08-12 10:44 -0700
Message-ID<185c01ce-aff4-4f1f-8b32-11385649b9f0@googlegroups.com>
In reply to#76119
On Tuesday, August 12, 2014 9:05:44 PM UTC+5:30, Johann Hibschman wrote:
> Rustom Mody writes:

> > - Pandas
> > - Numpy Scipy (which? how much?)

> For me, pandas is huge, numpy is a nice fundamental substrate, while
> only bits and pieces of scipy are used (mostly optimization).
> statsmodels may also be worth a mention, as the answer to "how do I do a
> regression".

statsmodels seems like something useful -- thanks for the pointer

[toc] | [prev] | [next] | [standalone]


#76122

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2014-08-12 15:50 +0000
Message-ID<lsdd3n$94t$2@dont-email.me>
In reply to#76105
On Tue, 12 Aug 2014 00:33:11 -0700, Rustom Mody wrote:

> Ive been asked to formulate a python course for financial services folk.

I wouldn't worry too much about c or c++ interfacing paradigms.

-- 
Denis McMahon, denismfmcmahon@gmail.com

[toc] | [prev] | [next] | [standalone]


#76127

FromRustom Mody <rustompmody@gmail.com>
Date2014-08-12 10:48 -0700
Message-ID<1c9a0c56-d898-4872-9df3-814816caf45f@googlegroups.com>
In reply to#76122
On Tuesday, August 12, 2014 9:20:16 PM UTC+5:30, Denis McMahon wrote:
> On Tue, 12 Aug 2014 00:33:11 -0700, Rustom Mody wrote:

> > Ive been asked to formulate a python course for financial services folk.

> I wouldn't worry too much about c or c++ interfacing paradigms.

And I dont like teaching that stuff either :-) [especially on windows!]

However those folks have thousands of lines of C/C++ which they are porting to python.

So...

Thanks anyway

[toc] | [prev] | [next] | [standalone]


#76136

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2014-08-12 18:54 +0000
Message-ID<lsdnsk$pin$1@dont-email.me>
In reply to#76127
On Tue, 12 Aug 2014 10:48:14 -0700, Rustom Mody wrote:

> However those folks have thousands of lines of C/C++ which they are
> porting to python.

That begs the question: Why?

Seriously, I'd like to know what benefits they expect to achieve by doing 
so.

-- 
Denis McMahon, denismfmcmahon@gmail.com

[toc] | [prev] | [next] | [standalone]


#76140

FromRustom Mody <rustompmody@gmail.com>
Date2014-08-12 12:05 -0700
Message-ID<35550897-4ead-421b-acd6-ddd282643209@googlegroups.com>
In reply to#76136
On Wednesday, August 13, 2014 12:24:12 AM UTC+5:30, Denis McMahon wrote:
> On Tue, 12 Aug 2014 10:48:14 -0700, Rustom Mody wrote:

> > However those folks have thousands of lines of C/C++ which they are
> > porting to python.

> That begs the question: Why?

> Seriously, I'd like to know what benefits they expect to achieve by doing 
> so.

Heh!
I asked more or less that.
Was told: "We want it!"

I gather its to do with "agility" -- faster time to incorporate and
integrate new logic into code etc.

[toc] | [prev] | [next] | [standalone]


#76150

FromLarry Martell <larry.martell@gmail.com>
Date2014-08-12 17:07 -0400
Message-ID<mailman.12900.1407877679.18130.python-list@python.org>
In reply to#76105
On Tue, Aug 12, 2014 at 3:33 AM, Rustom Mody <rustompmody@gmail.com> wrote:
> Ive been asked to formulate a python course for financial services folk.
>
> If I actually knew about the subject, I'd have fatter pockets!
> Anyway heres some thoughts. What I am missing out?
>
> [Apart from basic python -- contents typically needs tailoring to the audience] the following:
>
> - Libraries -- Decimal?
> - scripts -- philosophy and infrastructure eg argparse, os.path
> - Pandas
> - Numpy Scipy (which? how much?)
> - ipython + matplotlib + ??
> - Database interfacing
> - Excel interfacing (couple of libraries.. which?)
> - C(C++?) interfacing paradigms -- ranging from ctypes, cython to classic lo-level

I'm not 100% sure what you're looking for. I work for a hedge fund and
we make extensive use of python. Everything from soup to nuts: ETL,
web scraping, database access (sybase, MySQL, and Oracle), log file
archiving and reaping, wrappers for backups, startup and shutdown
scripts for our C++ servers, GIUs (with wxpython), socket based
communication with C++ servers, just about every problem that comes
up.

[toc] | [prev] | [next] | [standalone]


#76173

Fromwxjmfauth@gmail.com
Date2014-08-12 23:43 -0700
Message-ID<6232be8e-0438-4936-b257-828f0bb3e1c2@googlegroups.com>
In reply to#76105
Le mardi 12 août 2014 09:33:11 UTC+2, Rustom Mody a écrit :
> Ive been asked to formulate a python course for financial services folk.
> 
> 
> 
> If I actually knew about the subject, I'd have fatter pockets!
> 
> Anyway heres some thoughts. What I am missing out?
> 
> 
> 
> [Apart from basic python -- contents typically needs tailoring to the audience] the following:
> 
> 
> 
> - Libraries -- Decimal?
> 
> - scripts -- philosophy and infrastructure eg argparse, os.path
> 
> - Pandas
> 
> - Numpy Scipy (which? how much?)
> 
> - ipython + matplotlib + ??
> 
> - Database interfacing
> 
> - Excel interfacing (couple of libraries.. which?)
> 
> - C(C++?) interfacing paradigms -- ranging from ctypes, cython to classic lo-level

I recommend to toy intensively with the 'EURO SIGN' in
strings manipulations.

Py3: It may luckily work, Python may crash or fails (it raises
unicode errors on valid string!).

Py2: It is safer and solid. There is however a subtility. 3rd
party tools may consider the Euro as byte or as unicode and/or
are missinterpreting it, leading to a huge missmatch.

Example: IDLE

>>> print 'EURO' * 10
EURO  EURO  EURO  EURO  EURO  EURO  EURO  EURO  EURO  EURO
>>> print u'EURO' * 10
          
>>> # result: nothing!
>>> 


This is not specific to the Euro. I let as an
exercise to *understand* which chars are suffering
from this issue. (Py2 and Py3)

jmf

PS Go, Ruby, C#, TeX (unicode engines): never meet a problem.

[toc] | [prev] | [next] | [standalone]


#76575

FromLaurent Pointal <laurent.pointal@laposte.net>
Date2014-08-19 18:35 +0200
Message-ID<53f37ce1$0$2269$426a74cc@news.free.fr>
In reply to#76173
wxjmfauth@gmail.com wrote:

> I recommend to toy intensively with the 'EURO SIGN' in
> strings manipulations.
> 
> Py3: It may luckily work, Python may crash or fails (it raises
> unicode errors on valid string!).
> 
> Py2: It is safer and solid. There is however a subtility. 3rd
> party tools may consider the Euro as byte or as unicode and/or
> are missinterpreting it, leading to a huge missmatch.
> 
> Example: IDLE
> 
>>>> print 'EURO' * 10
> EURO  EURO  EURO  EURO  EURO  EURO  EURO  EURO  EURO  EURO
>>>> print u'EURO' * 10
>           
>>>> # result: nothing!
>>>> 

What version of Python do you use ?

With IDLE:

Python 3.4.0 (default, Apr 11 2014, 13:05:11) 
[GCC 4.8.2] on linux
Type "copyright", "credits" or "license()" for more information.
>>> print("€"*10)
€€€€€€€€€€
>>> 

With IDLE and Python 2.7, there seem to be an encoding problem:

>>> s = u"€"*10
>>> >>> import sys
>>> sys.stdout.encoding
'utf-8'
>>> print s.encode("utf-8")
€€€€€€€€€€
>>> print s.encode("latin1")
€€€€€€€€€€

But with python2 on console, it works nicely:

laurent@litchi:~$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more 
information.
>>> s = u'€'
>>> s*10
u'\u20ac\u20ac\u20ac\u20ac\u20ac\u20ac\u20ac\u20ac\u20ac\u20ac'
>>> print s*10
€€€€€€€€€€

> This is not specific to the Euro. I let as an
> exercise to *understand* which chars are suffering
> from this issue. (Py2 and Py3)
> 
> jmf
> 
> PS Go, Ruby, C#, TeX (unicode engines): never meet a problem.

[toc] | [prev] | [next] | [standalone]


#76608

FromTerry Reedy <tjreedy@udel.edu>
Date2014-08-19 17:59 -0400
Message-ID<mailman.13167.1408485615.18130.python-list@python.org>
In reply to#76575
On 8/19/2014 12:35 PM, Laurent Pointal wrote:
> wxjmfauth@gmail.com wrote:

>> Py3: It may luckily work, Python may crash or fails (it raises
>> unicode errors on valid string!).
>>
>> Py2: It is safer and solid.

The truth is that 2.7 has many unicode bugs that have been fixed in in 
various 3.x releases.  Please ignore jmf's disinformation campaign.


-- 
Terry Jan Reedy

[toc] | [prev] | [next] | [standalone]


#76616

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2014-08-20 00:00 +0100
Message-ID<mailman.13174.1408489224.18130.python-list@python.org>
In reply to#76575
On 19/08/2014 22:59, Terry Reedy wrote:
> On 8/19/2014 12:35 PM, Laurent Pointal wrote:
>> wxjmfauth@gmail.com wrote:
>
>>> Py3: It may luckily work, Python may crash or fails (it raises
>>> unicode errors on valid string!).
>>>
>>> Py2: It is safer and solid.
>
> The truth is that 2.7 has many unicode bugs that have been fixed in in
> various 3.x releases.  Please ignore jmf's disinformation campaign.
>

I don't believe that a single bug report has been raised by jmf during 
this two year long disinformation campaign.  Can somebody please confirm 
that I'm correct or provide references if I'm wrong.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web