Git Product home page Git Product logo

dx's People

Contributors

samrech avatar yhilpisch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dx's Issues

Reading full ukblc05.xls files in 10_dx_interest_rate_swaps

Hello Yves,

The data sheets oisf, fwds in the BoE yield curve files ukois09.xls and ukblc05.xls are an intermediate stage added to the original file to transpose the original matrices of data. This works well as a demo for a small matrix but becomes impossible when the full historical data of ukois09_mdaily.xls are downloaded (e.g. 2750Rx61C cannot be transposed in Excel).

Question: what do you advise doing on data input from these BoE Excel files into pandas? There must be a way to read/transpose directly from the original .xls files into the right data frame in python.

Thank you.

single_risk.py, max_value, mean_value, min_value

    # average value over whole path
    mean_value = np.mean(paths[:time_index], axis=1)
    # maximum value over whole path
    max_value = np.amax(paths[:time_index], axis=1)[-1]
    # minimum value over whole path
    min_value = np.amin(paths[:time_index], axis=1)[-1]

Should be:
# average value over whole path
mean_value = np.mean(paths[:time_index], axis=0)
# maximum value over whole path
max_value = np.amax(paths[:time_index], axis=0)
# minimum value over whole path
min_value = np.amin(paths[:time_index], axis=0)

Rename Distribution + Pip Installation

In setup.py:

#!/usr/bin/env python

from setuptools import setup, find_packages

DISTNAME = 'dx'

setup(name=DISTNAME,
		version='0.1',
                packages=find_packages(include=['dx', 'dx.*']),
		description='DX Analytics',
		author='Dr. Yves Hilpisch',
		author_email='[email protected]',
url='http://dx-analytics.com/')

Required packages:

pip install pandas-datareader

Install package:

pip install git+git://github.com/yhilpisch/dx.git

PicklingError in 00_dx_quickstart, 06_dx and 13_dx notebooks

Running dx-master locally on Windows 8.2, Anaconda 2.4.1 and python 2.7, the following error arises at ln[34]


PicklingError Traceback (most recent call last)
in ()
----> 1 port.get_values()

C:\Users\Denis\Finmod\dx-master\dx\dx_valuation.pyc in get_values(self, fixed_seed)
905 if self.parallel is True:
906 self.underlying_objects =
--> 907 simulate_parallel(self.underlying_objects.values())
908 results = value_parallel(self.valuation_objects.values())
909 # iterate over all positions in portfolio

C:\Users\Denis\Finmod\dx-master\dx\dx_valuation.pyc in simulate_parallel(objs, fixed_seed)
1130 for o in objs:
1131 procs.append(mp.Process(target=worker, args=(o, output)))
-> 1132 [pr.start() for pr in procs]
1133 [pr.join() for pr in procs]
1134 results = [output.get() for o in objs]

C:\Users\Denis\Anaconda3\envs\py27\lib\multiprocessing\process.pyc in start(self)
128 else:
129 from .forking import Popen
--> 130 self._popen = Popen(self)
131 _current_process._children.add(self)
132

C:\Users\Denis\Anaconda3\envs\py27\lib\multiprocessing\forking.pyc in init(self, process_obj)
275 try:
276 dump(prep_data, to_child, HIGHEST_PROTOCOL)
--> 277 dump(process_obj, to_child, HIGHEST_PROTOCOL)
278 finally:
279 del Popen._tls.process_handle

C:\Users\Denis\Anaconda3\envs\py27\lib\multiprocessing\forking.pyc in dump(obj, file, protocol)
197
198 def dump(obj, file, protocol=None):
--> 199 ForkingPickler(file, protocol).dump(obj)
200
201 #

C:\Users\Denis\Anaconda3\envs\py27\lib\pickle.pyc in dump(self, obj)
222 if self.proto >= 2:
223 self.write(PROTO + chr(self.proto))
--> 224 self.save(obj)
225 self.write(STOP)
226

C:\Users\Denis\Anaconda3\envs\py27\lib\pickle.pyc in save(self, obj)
329
330 # Save the reduce() output and finally memoize the object
--> 331 self.save_reduce(obj=obj, *rv)
332
333 def persistent_id(self, obj):

C:\Users\Denis\Anaconda3\envs\py27\lib\pickle.pyc in save_reduce(self, func, args, state, listitems, dictitems, obj)
423
424 if state is not None:
--> 425 save(state)
426 write(BUILD)
427

C:\Users\Denis\Anaconda3\envs\py27\lib\pickle.pyc in save(self, obj)
284 f = self.dispatch.get(t)
285 if f:
--> 286 f(self, obj) # Call unbound method with explicit self
287 return
288

C:\Users\Denis\Anaconda3\envs\py27\lib\pickle.pyc in save_dict(self, obj)
653
654 self.memoize(obj)
--> 655 self._batch_setitems(obj.iteritems())
656
657 dispatch[DictionaryType] = save_dict

C:\Users\Denis\Anaconda3\envs\py27\lib\pickle.pyc in _batch_setitems(self, items)
685 for k, v in tmp:
686 save(k)
--> 687 save(v)
688 write(SETITEMS)
689 elif n:

C:\Users\Denis\Anaconda3\envs\py27\lib\pickle.pyc in save(self, obj)
284 f = self.dispatch.get(t)
285 if f:
--> 286 f(self, obj) # Call unbound method with explicit self
287 return
288

C:\Users\Denis\Anaconda3\envs\py27\lib\pickle.pyc in save_global(self, obj, name, pack)
752 raise PicklingError(
753 "Can't pickle %r: it's not found as %s.%s" %
--> 754 (obj, module, name))
755 else:
756 if klass is not obj:

PicklingError: Can't pickle <function worker at 0x0000000020680668>: it's not found as dx.dx_valuation.worker

The same arises in 06-dx-prtfolio-parallel notebook and 13_dx_quite_ complex_portfolio notebook, in short everytime port.et_values or port.Get_statistics is used.

In addition, the recently updated vc.vega('gbm1') in 04_dx_valuation notebook and others produces this error:


TypeError Traceback (most recent call last)
in ()
----> 1 vc.vega('gbm1')

C:\Users\Denis\Finmod\dx-master\dx\dx_valuation.pyc in vega(self, key, interval)
513 def vega(self, key, interval=0.01):
514 if len(self.instrument_values) == 0:
--> 515 self.get_instrument_values()
516 asset = self.underlying_objects[key]
517 if interval < asset.volatility / 50.:

C:\Users\Denis\Finmod\dx-master\dx\dx_valuation.pyc in get_instrument_values(self, fixed_seed)
471 for obj in self.underlying_objects.values():
472 if obj.instrument_values is None:
--> 473 obj.generate_paths(fixed_seed=fixed_seed)
474
475 def update(self, key=None, initial_value=None, volatility=None,

C:\Users\Denis\Finmod\dx-master\dx\dx_models.pyc in generate_paths(self, fixed_seed, day_count)
186 ran = np.dot(self.cholesky_matrix, rand[:, t, :])
187 ran = ran[self.rn_set]
--> 188 dt = (self.time_grid[t] - self.time_grid[t - 1]).days / day_count
189 # difference between two dates as year fraction
190 rt = (forward_rates[t - 1] + forward_rates[t]) / 2

TypeError: unsupported operand type(s) for -: 'datetime.datetime' and 'float'

Thank you for your attention.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.