SERVING THE QUANTITATIVE FINANCE COMMUNITY

 
User avatar
ISayMoo
Posts: 2365
Joined: September 30th, 2015, 8:30 pm

Re: Python tricks

July 20th, 2020, 2:36 pm

I'll post the code some time soon. It will be Open Source.
How's it going here? we would like to test it.
Precise, step-by-step documentation is essential.
It's something I tinker with in my spare time ;-)
 
User avatar
ISayMoo
Posts: 2365
Joined: September 30th, 2015, 8:30 pm

Re: Python tricks

August 9th, 2020, 1:16 am

Cool. Is this public domain and can we use it for our ML project? 
There ya go.
 
User avatar
Cuchulainn
Posts: 62871
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Re: Python tricks

August 9th, 2020, 8:30 am

Cool. Is this public domain and can we use it for our ML project? 
There ya go.
Great, thank you very much. I will relate it to the hinterland.
Will also send you our pybind11 - C++ checklist.
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl
 
User avatar
ISayMoo
Posts: 2365
Joined: September 30th, 2015, 8:30 pm

Re: Python tricks

August 9th, 2020, 5:56 pm

Thanks. Let me know if you have any questions.
 
User avatar
Cuchulainn
Posts: 62871
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Re: Python tricks

August 19th, 2020, 3:34 pm

Anyone tries scipy {DE, brute, basin hopping, shgo} global optimisation as an alternative to ANN?

Severe test is Eggholder function; find global _and_ all locals ;)

Image
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl
 
User avatar
tagoma
Topic Author
Posts: 18375
Joined: February 21st, 2010, 12:58 pm

Re: Python tricks

August 24th, 2020, 10:15 pm

There have been quite a lot of developments in recent python versions. Is there a proper construct that would be like a class with no (or very basic) methods, and only (mainly) with attributes (anemic construct?). In C++, I would go for struct, I think (adding drama here; drama sells, right?). My use case is a Order object that would have security, size, order_type, and other such attributes.
All constructive comments/recommendations on this much welcome.
Thank you very much.  
 
User avatar
Cuchulainn
Posts: 62871
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Re: Python tricks

August 25th, 2020, 9:11 am

Classes in  Python are not prize-winning TBH.

By a struct do you mean all data is public by default like in C++?

Plan B: Put Order in a module having attributes, def statements and bind functions.

In fact, this approach of breaking a software system into loosely-coupled and cohesive modules leads to code that is more maintainable than code using OOP.
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl
 
User avatar
tagoma
Topic Author
Posts: 18375
Joined: February 21st, 2010, 12:58 pm

Re: Python tricks

August 25th, 2020, 10:04 am

Classes in  Python are not prize-winning TBH.

By a struct do you mean all data is public by default like in C++?

Plan B: Put Order in a module having attributes, def statements and bind functions.
Thank you Cuchulainn.
Yes, you guessed it right. I would like all data is public e.g. the Book class will need to access data in that construct Order e.g. to check whether there already is an opened position for that security, and everything else...
Note: I'm keeping this order/book management code very light. It is not "real" trading position management system. It is aimed at handling some risk/capital/positions constraints of a RL trading agent (my related question in another Wilmott forum, recently).
 
User avatar
Peniel
Posts: 59
Joined: April 8th, 2006, 9:46 am

Re: Python tricks

August 25th, 2020, 10:08 am

There have been quite a lot of developments in recent python versions. Is there a proper construct that would be like a class with no (or very basic) methods, and only (mainly) with attributes (anemic construct?). In C++, I would go for struct, I think (adding drama here; drama sells, right?). My use case is a Order object that would have security, size, order_type, and other such attributes.
All constructive comments/recommendations on this much welcome.
Thank you very much.  
maybe dataclass?
 
User avatar
tagoma
Topic Author
Posts: 18375
Joined: February 21st, 2010, 12:58 pm

Re: Python tricks

August 25th, 2020, 10:25 am

There have been quite a lot of developments in recent python versions. Is there a proper construct that would be like a class with no (or very basic) methods, and only (mainly) with attributes (anemic construct?). In C++, I would go for struct, I think (adding drama here; drama sells, right?). My use case is a Order object that would have security, size, order_type, and other such attributes.
All constructive comments/recommendations on this much welcome.
Thank you very much.  
maybe dataclass?
Thank you for this suggestion @Peniel. I wasn't aware of dataclasses. I'm looking into it now,
 
User avatar
ISayMoo
Posts: 2365
Joined: September 30th, 2015, 8:30 pm

Re: Python tricks

August 25th, 2020, 11:06 am

Seconding Peniel. dataclasses are the way to go now.
 
User avatar
katastrofa
Posts: 9564
Joined: August 16th, 2007, 5:36 am
Location: Alpha Centauri

Re: Python tricks

August 25th, 2020, 4:00 pm

Tagoma says that he wants a C++ struct-like type and you're recommending a type of a mutable object?

Alright, it's (frozen=True)
dataclass(*, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=True)
 
User avatar
Cuchulainn
Posts: 62871
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Re: Python tricks

August 26th, 2020, 11:11 am

There have been quite a lot of developments in recent python versions. Is there a proper construct that would be like a class with no (or very basic) methods, and only (mainly) with attributes (anemic construct?). In C++, I would go for struct, I think (adding drama here; drama sells, right?). My use case is a Order object that would have security, size, order_type, and other such attributes.
All constructive comments/recommendations on this much welcome.
Thank you very much.  
maybe dataclass?
Can you give a sales pitch as this library looks like cargo cult at first glance. In other words, what's the compelling reason for using it?

Nice to see you again, @Peniel (your [$]e^5[$] thread was a gem, but it suffered a fate worse than that of Dresden, i.e. FUBAR).
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl
 
User avatar
Cuchulainn
Posts: 62871
Joined: July 16th, 2004, 7:38 am
Location: Amsterdam
Contact:

Re: Python tricks

August 26th, 2020, 11:14 am

At the end of the day, tagoma seems to be traditional data modelling ... SQL etc.?
COBOL is better. I'm kind of serious (Python is replacing Java for COBOL API)

https://pypi.org/project/cobutils/

tech python libraries are in C++, Fortran

Python wasn't built for DB, but COBOL was.

why not? save a lot of messing around. BTW I'll have you know I was a Michael Jackson certified COBOL programmer in 1980, using _real_ computers!

Software savvy 1980s >> 2020
https://en.wikipedia.org/wiki/Michael_A._Jackson
Step over the gap, not into it. Watch the space between platform and train.
http://www.datasimfinancial.com
http://www.datasim.nl
 
User avatar
ISayMoo
Posts: 2365
Joined: September 30th, 2015, 8:30 pm

Re: Python tricks

August 31st, 2020, 10:08 pm

Cool. Is this public domain and can we use it for our ML project? 
There ya go.
Great, thank you very much. I will relate it to the hinterland.
Will also send you our pybind11 - C++ checklist.
Any thoughts on how to generate HTML documentation automatically for pybind11-generated Python modules? For C++ I do with Doxygen, but I don't know how to handle binary Python wrappers.
ABOUT WILMOTT

PW by JB

Wilmott.com has been "Serving the Quantitative Finance Community" since 2001. Continued...


Twitter LinkedIn Instagram

JOBS BOARD

JOBS BOARD

Looking for a quant job, risk, algo trading,...? Browse jobs here...


GZIP: On