How do I load Java classes into Python using concise syntax?
These methods import information for use in your queries:
importClass(Class classToImport)
- Imports a class for use in a query.importStatic(Class classToImport)
- Imports the static methods from a class for use in a query.
For example, if you wanted to load the necessary Java classes into Python for BlackScholes, the following example allows you to pull in Java functionality using compact syntax in the query strings:
from deephaven import jpy
from deephaven.TableTools import emptyTable
BS = jpy.get_type("com.illumon.numerics.derivatives.BlackScholes")
db.importClass(BS.jclass)
db.importStatic(BS.jclass)
t = emptyTable(10) \
.update("FullPath = com.illumon.numerics.derivatives.BlackScholes.price(true, 100, 90, 0.1, 0.01, 0.01, 0.4)") \
.update("ImportClass = BlackScholes.price(true, 100.0, 90.0, 0.1, 0.01, 0.01, 0.4)") \
.update("ImportStatic = price(true, 100.0, 90.0, 0.1, 0.01, 0.01, 0.4)")
Last Updated: 16 February 2021 18:06 -04:00 UTC Deephaven v.1.20200928 (See other versions)
Deephaven Documentation Copyright 2016-2020 Deephaven Data Labs, LLC All Rights Reserved