Giter Club home page Giter Club logo

loc-extension's Introduction

LOC-Extension: LibreOffice calc Cryptocurrency market functions

The LOC extension allows you to create customized spreadsheets with cryptocurrency market data directly from the web. This version (0.2.3) provides 2 lookup functions: a dedicated getPoloniex() (for compatibility with version 0.1.0) and a generic ccxt() which uses an embedded snapshot of the amazing ccxt library. This means over 90 exchanges are now supported.

Download

You can download the current version of the LOC Extension here 0.2.3

The LOC extension is also available from the LibreOffice Extension Center.

NOTE: The extension itself is LOC.oxt. The example .ods worksheet demonstrates how to use the extension.

Usage

The LOC Extension adds two new functions to Calc. The first is:

GETPOLONIEX(Ticker,Datacode) 

Quotes must be used when entering the ticker directly ex: GETPOLONIEX("BTC_ETH","last"), but are not needed when referencing another cell ex: GETPOLONIEX(A1,A2).

In the latter case the data in A1 should be BTC_ETH, not "BTC_ETH".

NOTE: The full set of datacodes are demonstrated in the example .ods worksheet included with the release. The worksheet also contains a full list of the available symbols/currency-pairs.

The second new function is:

CCXT(Exchange, Ticker, Datacode)

Exchange is any exchange name supported by the embedded ccxt snapshot (version 1.9.262). Quotes must be used according to the same rules as for GETPOLONIEX().

Ticker is a currency pair from the ccxt unified API. NOTE: The format of the ticker is different from that for GETPOLONIEX(). The valid values depend on the exchange being addressed. They are generally coin/coin, eg: ETH/BTC when buying/selling ETH and paying/getting paid in BTC.

Datacode is one of the ccxt supported data items for the fetch_ticker function. The one you'll probably use most is "last".

Performance

v0.2.3 introduces caching for some of the ccxt supported exchanges. This relies on the ccxt load_markets() function downloading data for every ticker combination supported by the exchange. The cached information is then used for every subsequent lookup for that exchange. If you're pulling the prices for many tickers and you have a slow internet connection this provides a very substantial, very worthwhile, performance improvement after the first fetch.

The exchanges which provide caching are bitmex, coinmarketcap, gatecoin, lakebtc, livecoin, luno, nova, poloniex, qryptos, quoine, therock and vaultoro.

If you bought coins from, or store coins on (NOT recommnded), multiple exchanges and you have less than stellar internet performance you might want to consider getting price information from a single caching exchange if it carries all of your coins. If no one caching exchange carries all of your coins then consider getting data from Coinmarketcap if performance is more important than up to the minute accuracy.

Coinmarketcap (Updated 27 November 2018)

Coinmarketcap plan to deprecate their "public" API on 4 December 2018. They have released a tiered "professional" API replacement. This has various levels of functionality/price points, including a free "basic" level. None of the levels provide identical functionality to the deprecated API.

After they make the switch, LOC-Extension will no longer be able to pull data from Coinmarketcap.

Coinmarketcap is supported by ccxt but it is not a regular exchange; it is an aggregator. It works slightly differently to a regular exchange. It doesn't provide coin/coin tickers. Instead, it provides coin/fiat tickers for 15 supported fiat currencies (AUD, BRL, CAD, CHF, CNY, EUR, GBP, HKD, IDR, INR, JPY, KRW, MXN, RUB, and USD). In addition it provides some special data like total market cap in USD and bitcoin crypto-currency market percentage dominance. These are accessed using a special ticker, "GLOBAL", and datacode items "market_cap" and "dominance". Further, there are 2 special data items for each coin: market cap in USD, and rank. These are accessed from the coin/USD ticker with datacodes "market_cap_usd" and "rank". Since the data is aggregated from multiple exchanges and not real-time this is one of the sources which uses caching. If you just want a reasonable approximation of the current value of each coin in your portfolio then coinmarketcap is the quickest way to get it via the LOC-Extension. Coinmarketcap is a bit of a work-in-progress and right now returns cached data from the markets info field, the contents and labels of which are not the same as in the fetch_ticker() function. So right now instead of using "last" for the price it is necessary to use "price_btc" or "price_usd".

Windows users

At the present time v0.2.2 is the only version recommended for Windows users. This is because some have experienced problems installing v0.2.0. LOC-Extension includes some logging which worked on the test Windows (7) machine I had access to but which is incompatible with (at least some) other machines. I do not currently have access to a Windows (any version) machine for testing.

Windows users are STRONGLY recommended to make a system snapshot before installing this or any other LibreOffice extension. Then when it goes horribly wrong you'll have a much simpler time recovering.

Upgrading

The LibreOffice extension mechanism is poorly documented and extremely fragile. It is STRONGLY recommended that you remove the previous version of LOC-Extension before adding this one. If you use the replace option you might or might not end up with indecipherable error messages or an unusable extension.

LibreOffice does not handle extension files with spaces in the names well. The spaces usually end up being there because your browser renames files to things like "LOC (1).oxt" if there is already a (previous) version in your download directory. If you attempt to install/upgrade using such a file the process will fail and leave the extension in an inconsistent state: it won't appear in the installed extensions list but if you try to install the same version again it will say it is already installed. Take care to remove previous downloads before downloading the latest extension, or to rename it after downloading and remove any spaces from the filename. See bug 114708

If you/LibreOffice really screw things up I recommend closing LibreOffice, renaming the entire customisation directory (~/.config/libreoffice/4 on linux), restarting it and re-installing (all) your extensions.

Recovering from a messed-up extension installation/upgrade is much harder for Windows users. Really, make a system snapshot before installing or upgrading any LibreOffice extension.

Dependencies

LOC-Extension is fully standalone. It includes an embedded snapshot of Igor Kroitor's ccxt.

Support

For general support please visit the forums. If you find a bug or wish to request a feature please file an issue at the issue tracker.

Contribute

Help is always welcome with development. If you would like to contribute you will need to fork the main repo, make your changes, and send a pull request to have your changes moderated and merged back into the main repo. Details on that process can be found here.

License

The LOC Extension is released under the which in layman's terms means:

  • You are permitted to use, copy and redistribute the work "as-is".
  • You may adapt, remix, transform and build upon the material, releasing any derivatives under your own name.
  • You may use the material for commercial purposes as long as the derivative is licenced under the GPL.
  • You must track changes you make in the source files.
  • You must include or make available the source code with your release.

ccxt is released under the MIT license.

Warranty

There is NO warranty of any kind. You use the software entirely at your own risk. I am not responsible if anything goes wrong.

Other Contributors and Thanks!

  • madsailor - provided the original SMF Extension that LOC is based on
  • Igor Kroitor - actively maintains the ccxt library

Donate

If you find the extension useful and feel like throwing some coins my way, please use one of these addresses:

  • LTC: MDH8P4XcaZEwrX7PrQVxag4matzHmmjnVa

loc-extension's People

Contributors

walkjivefly 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

loc-extension's Issues

Getting Err:504 even in the Examples.ods

Hi,
I could install the extension, but I can't get even Examples.ods to work. The cells with the extension calls all show "Err:504". Any idea why?

LOC-Extension version: 0.2.3

Platform you're running it on: Windows 7 x64

Expected behaviour: returning the value of the formula

Actual behaviour: Err:504

cannot install LOC extension

I am running Windows 10 (64 bits) and I am trying to install Loc extension v2 but it gives me a very long error message: "(com.sun.star.uno.RuntimeException) { { Message = "<class 'FileNotFoundError'>: [Errno 2] No such file or directory: 'C:\\tmp\\LOC_14796', traceback follows\X000a File "C:\Program Files (x86)\LibreOffice 5\program\pythonloader.py", line 149, in writeRegistryInfo\X000a mod = self.getModuleFromUrl( locationUrl )\X000a File "C:\Program Files (x86)\LibreOffice 5\program\pythonloader.py", line 103, in getModuleFromUrl\X000a exec(codeobject, mod.dict)\X000a File "C:\Users\HUGUES\AppData\Roaming\LibreOffice\4\user\uno_packages\cache\uno_packages\lu137121fpwsx.tmp_\LOC.oxt\loc.py", line 38, in \X000a fh = logging.FileHandler(logfile, mode='a', encoding=None, delay=False)\X000a File "C:\Program Files (x86)\LibreOffice 5\program\python-core-3.3.0\lib\logging\init.py", line 969, in init\X000a StreamHandler.init(self, self._open())\X000a File "C:\Program Files (x86)\LibreOffice 5\program\python-core-3.3.0\lib\logging\init.py", line 993, in _open\X000a return open(self.baseFilename, self.mode, encoding=self.encoding)\X000a\X000a", Context = (com.sun.star.uno.XInterface) @0 } }"

Libreoffice version is 5.3.3.2

How can I solve this?

Regards,

Hugues

LibreOffice 6: cannot instantiate python

Thank you for taking the time to report an issue. To help me help you please specify

LOC-Extension version:

both:

  • latest one from official libreoffice extensions distribution site AND
  • v0.2.3 from github releases

Platform you're running it on:

Ubuntu 18.04.x

Expected behaviour:

Would run python ok

Actual behaviour:

Shows error dialog box (dialog box pixmap below, the Russian dialog title translates as `Extenstion management'):

image

file not found exception on install

LOC-Extension version:

0.2.3

Platform you're running it on:

Windows 8.1 64 bit, LibreOffice 6.3.4.2 (x64)

Expected behaviour:

extension installs without issues

Actual behaviour:

I get the following error dialog upon trying to install:
(com.sun.star.uno.RuntimeException) { { Message = "<class 'FileNotFoundError'>: [Errno 2] No such file or directory: 'C:\\tmp\\LOC_11096', traceback follows\X000a File "C:\Program Files\LibreOffice\program\pythonloader.py", line 149, in writeRegistryInfo\X000a mod = self.getModuleFromUrl( locationUrl )\X000a File "C:\Program Files\LibreOffice\program\pythonloader.py", line 104, in getModuleFromUrl\X000a exec(codeobject, mod.dict)\X000a File "C:\Users\mortee\AppData\Roaming\LibreOffice\4\user\uno_packages\cache\uno_packages\lu10352x8tz09.tmp_\LOC-0.2.3.oxt\loc.py", line 38, in \X000a fh = logging.FileHandler(logfile, mode='a', encoding=None, delay=False)\X000a File "C:\Program Files\LibreOffice\program\python-core-3.5.9\lib\logging\init.py", line 1014, in init\X000a StreamHandler.init(self, self._open())\X000a File "C:\Program Files\LibreOffice\program\python-core-3.5.9\lib\logging\init.py", line 1043, in _open\X000a return open(self.baseFilename, self.mode, encoding=self.encoding)\X000a\X000a", Context = (com.sun.star.uno.XInterface) @0 } }

Serious vulnerability issue

Hi,
the 0.3.0 branch comes with a RUNCOMMAND() function which allows to execute any external command.
This, IMHO is a major security issue.

It would be extremely simple to introduce a keylogger, spyware, rootkit or download any type of malware from a spreadsheet (Starting with Examples.ods )

So I strongly recommend to deactivate this function in the code and recompile before you install the plugin.

As we all know, the cryptocurrency world is full of hackers & thieves, so be warned

Best regards

Fetch Historical Data?

Ubuntu 7.10 and LOC .0.2.3

Great plugin, thanks very much for your work! I'm hoping to fetch historical data, ideally from adjacent cells, but I'm having a hard time.

In examples.ods>ccxt I see the 'datacode' options for timestamp and datetime - looks perfect!

However, I can't get anything other than #VALUE!

datetime is ISO8601 so I thought just putting 2017-03-12 would fetch the data for a particular pair on a particular exchange on that date.

For example

=CCXT("BitFinex","BTC/USD","last") works great but =CCXT("BitFinex","BTC/USD","2017-03-04") returns Exception Encountered.

So, is what I am trying to do possible and if so could you please tell me how ๐Ÿฅ‡

Thanks very much for your time.

Errors when testing example

LOC version 0.23 (but bug affect 0.22)
install with oxt in ubuntu 23.04

=GETPOLONIEX("BTC_ETH";"last") give Something bad happened

=CCXT("coinmarketcap";CONCAT("ETH";"/usd");"market_cap_usd") give Exception encountered

Compatibility with new CMC API key

"The Public API will be migrating to the new, more powerful Professional API on December 4th, 2018. Please update your application to use the free tier of the Professional API before then. "

If it's not compatible (due to added personal authentication key), will this ext. be upgraded as well?

I'm moving from google sheet to LOC. Wonder if I should do it now or later after I see that CMC is upgrading its API key. Thanks.

LOC

Cannot install - get the following:

(com.sun.star.uno.RuntimeException) { { Message = "<class 'FileNotFoundError'>: [Errno 2] No such file or directory: 'C:\\tmp\\LOC_5476', traceback follows\X000a File "C:\Program Files\LibreOffice 5\program\pythonloader.py", line 149, in writeRegistryInfo\X000a mod = self.getModuleFromUrl( locationUrl )\X000a File "C:\Program Files\LibreOffice 5\program\pythonloader.py", line 103, in getModuleFromUrl\X000a exec(codeobject, mod.dict)\X000a File "C:\Users\Deon\AppData\Roaming\LibreOffice\4\user\uno_packages\cache\uno_packages\lu5340187u2.tmp_\LOC.oxt\loc.py", line 38, in \X000a fh = logging.FileHandler(logfile, mode='a', encoding=None, delay=False)\X000a File "C:\Program Files\LibreOffice 5\program\python-core-3.5.0\lib\logging\init.py", line 1014, in init\X000a StreamHandler.init(self, self._open())\X000a File "C:\Program Files\LibreOffice 5\program\python-core-3.5.0\lib\logging\init.py", line 1043, in _open\X000a return open(self.baseFilename, self.mode, encoding=self.encoding)\X000a\X000a", Context = (com.sun.star.uno.XInterface) @0 } }

Discord bot test

Thank you for taking the time to report an issue. To help me help you please specify

LOC-Extension version:

Platform you're running it on:

Expected behaviour:

Actual behaviour:

#NAME? error message

Hi,
This may not a problem with your plugin, but as an experienced LibreOffice plugin developer, you may have an idea on how to help me:

I compiled your master branch with LibreOffice 7.4.5.1 On Manjaro Linux.
Once the plugin add to LibreOffice, I can see them in the "functions List" :
AUTOADDIN.LOC.CCTX
AUTOADDIN.LOC.GERTPOLONIEX

but when I try to use them, I get the #NAME? error message.

This is how I call it:
=autoaddin.loc.ccxt("binance", "BTC/BUSD","last")
or
=ccxt("binance", "BTC/BUSD","last")

When opening your Examples.ods, I get some red "Exceptions encountered" or "something bad happened" messages.

Thank you very much for your plugin and your help
Louis

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.