Skip to main content

A small package to do some finops optimisations

Project description

FinOptim package

The best python package to help you optimise your cloud spendings

Instalation

The package is available on PyPI, it is possible to install it directly with pip.

pip install finoptim

It requires at least Python 3.10. The documentation is available on readthedoc.

Usage example

import finoptim as fp
import pandas as pd


past_usage = pd.DataFrame(...) # some query of yours
prices = fp.prices.aws()
print(prices_df.iloc[:, :4].to_markdown(
    tablefmt='rounded_outline',
    numalign='center'))
>>>
╭──────┬────────────┬──────────────┬─────────────────┬──────────────╮
        Arlequin    Moratorium    Anthropophage    Apophtegme  
├──────┼────────────┼──────────────┼─────────────────┼──────────────┤
 OD      0.167        0.122          0.0056          0.0058    
 RI3Y  0.0637352    0.0476682       0.0022035      0.00234155  
 RI1Y  0.0981063    0.0716404      0.00330824      0.00330824  
 SP1Y    0.115         0.09          0.0038          0.0039    
 SP3Y    0.073        0.054          0.0025          0.0026    
╰──────┴────────────┴──────────────┴─────────────────┴──────────────╯

All the prices are per hours.

Proceeding to the optimisation is made with the optimise function

res = fp.optimise(past_usage, prices)

The optimise function can take as input lots of different predictions, and also current commitments. The optimisation is made with all the pricing models found in the prices object

predictions = [pd.DataFrame(...), ...] # some query of yours

res = fp.optimise(
    predictions,
    prices,
    current_commitments={"type" : "RI3Y", "level" : 10 * 32, 'guid' : 'Moule à gaufres', "end_date" : date(2024, 12, 21), 'price_key' : .0123},
    convergence_details=True
    )

Now the res object hold the best levels of commitment on the time period.

guid_to_instance_name = {"K7YHHNFGTNN2DP28" : 'i3.large', 'SAHHHV5TXVX4DCTS' : 'r5.large'}
res.format(instance_type=guid_to_instance_name)
print(res)
>>>
╭─────────────────┬──────────────────────────┬───────────────╮
 instance_type     three_year_commitments   price_per_day 
├─────────────────┼──────────────────────────┼───────────────┤
 i3.large                   1338                2,886     
 r5.large                   1570                2,564     
 savings plans              1937                1,937     
╰─────────────────┴──────────────────────────┴───────────────╯

TODO

lib convenience

  • allow for long DataFrame as input
  • the cost function should return a gradient when evaluated (save some compute)(the function is a nightmare : abort the mission)
  • listening to keyboard interupt from Rust is harder than expected with multi threading
  • logging instead of printing, both in the Python and Rust sides

actual problems

  • find a real stop condition for the inertial optimiser
  • can we guess the "eigenvectors" of the problem ? if we have estimations, we can set great parameters for the inertial optimiser
  • problem is highly non linear and this will require more thinking

Project size

wc -l src/finoptim/*.py rust/src/*.rs src/finoptim/prices/*.py tests/*.py

is around 3k lines of code

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

finoptim-0.1.72.tar.gz (32.9 kB view details)

Uploaded Source

Built Distributions

finoptim-0.1.72-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

finoptim-0.1.72-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB view details)

Uploaded PyPy manylinux: glibc 2.17+ ARM64

finoptim-0.1.72-pp310-pypy310_pp73-manylinux_2_12_i686.manylinux2010_i686.whl (1.4 MB view details)

Uploaded PyPy manylinux: glibc 2.12+ i686

finoptim-0.1.72-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.13 manylinux: glibc 2.17+ ARM64

finoptim-0.1.72-cp312-none-win_amd64.whl (397.4 kB view details)

Uploaded CPython 3.12 Windows x86-64

finoptim-0.1.72-cp312-none-win32.whl (350.1 kB view details)

Uploaded CPython 3.12 Windows x86

finoptim-0.1.72-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

finoptim-0.1.72-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ ARM64

finoptim-0.1.72-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.whl (1.4 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.12+ i686

finoptim-0.1.72-cp311-none-win_amd64.whl (398.1 kB view details)

Uploaded CPython 3.11 Windows x86-64

finoptim-0.1.72-cp311-none-win32.whl (351.7 kB view details)

Uploaded CPython 3.11 Windows x86

finoptim-0.1.72-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

finoptim-0.1.72-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

finoptim-0.1.72-cp311-cp311-manylinux_2_12_i686.manylinux2010_i686.whl (1.4 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.12+ i686

finoptim-0.1.72-cp311-cp311-macosx_11_0_arm64.whl (497.9 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

finoptim-0.1.72-cp311-cp311-macosx_10_7_x86_64.whl (553.5 kB view details)

Uploaded CPython 3.11 macOS 10.7+ x86-64

finoptim-0.1.72-cp310-none-win_amd64.whl (398.1 kB view details)

Uploaded CPython 3.10 Windows x86-64

finoptim-0.1.72-cp310-none-win32.whl (351.7 kB view details)

Uploaded CPython 3.10 Windows x86

finoptim-0.1.72-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

finoptim-0.1.72-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

finoptim-0.1.72-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.whl (1.4 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.12+ i686

finoptim-0.1.72-cp310-cp310-macosx_11_0_arm64.whl (497.9 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

finoptim-0.1.72-cp310-cp310-macosx_10_7_x86_64.whl (553.5 kB view details)

Uploaded CPython 3.10 macOS 10.7+ x86-64

File details

Details for the file finoptim-0.1.72.tar.gz.

File metadata

  • Download URL: finoptim-0.1.72.tar.gz
  • Upload date:
  • Size: 32.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.3.1

File hashes

Hashes for finoptim-0.1.72.tar.gz
Algorithm Hash digest
SHA256 f379525a4e8c96224e19464da3fb88f828cb7567f27fc07103b816b0c10a9f56
MD5 d9d2bb73dbe426bea4c15ae8fd70dff7
BLAKE2b-256 5cd9fdaec258561af1f22e76f24a1da3814fcbd99e69decee3e4dbb57e1569ae

See more details on using hashes here.

File details

Details for the file finoptim-0.1.72-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for finoptim-0.1.72-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 439078f706ff075f7d5f1cec39028ef42238fa48f639e52086e5e0ed7a7fa710
MD5 fe9cfab4a51efbc94fc0ae138c059b9a
BLAKE2b-256 6c9624ea32734fbd4afd00143d397d317d5fe40ea7cbe7431a95042842225b9a

See more details on using hashes here.

File details

Details for the file finoptim-0.1.72-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for finoptim-0.1.72-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 60b5e18053e535fa0eb6c55c774ef8af0d01cc4f7b22de88861d64f46b3a3b4d
MD5 7be1efdf4b779334c46e7c1e3de36a6e
BLAKE2b-256 0b892f811a9a1ef1d6c11f37a369148cd18e7e01b79506c3521954aa1e63a3f2

See more details on using hashes here.

File details

Details for the file finoptim-0.1.72-pp310-pypy310_pp73-manylinux_2_12_i686.manylinux2010_i686.whl.

File metadata

File hashes

Hashes for finoptim-0.1.72-pp310-pypy310_pp73-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 aaf17a4b5543c79426c3e59482aa63f993ee0aa655bc530cfcd50e70468d3a98
MD5 0bc6a9157719bd36d777e4b61464dab7
BLAKE2b-256 9c5e1c1b8fd255d7cb20007c0520041f23cb07730bbd6e2051f7581dee25db28

See more details on using hashes here.

File details

Details for the file finoptim-0.1.72-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for finoptim-0.1.72-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 46f72c39401af3b08b1aa4d441f1e92b18536c19470b1e3edaf1f82769820732
MD5 a519169e623a6a395a187cc98ff6ace9
BLAKE2b-256 b6b904080e592f97b2def8fe144b5ab8ecbad9df44ee2218bdddc0f017de973d

See more details on using hashes here.

File details

Details for the file finoptim-0.1.72-cp312-none-win_amd64.whl.

File metadata

File hashes

Hashes for finoptim-0.1.72-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 eedd70f194b66c56ab3bc7c7c8bb0a152c9810949bed118806abdf53c3442f6a
MD5 8ffbdebf03922aa4396a7e94b7aab5c4
BLAKE2b-256 e3828a61ff05e66fcf530fbcad0efa2abb3b7e15d7a60b24db10af974bb328d3

See more details on using hashes here.

File details

Details for the file finoptim-0.1.72-cp312-none-win32.whl.

File metadata

  • Download URL: finoptim-0.1.72-cp312-none-win32.whl
  • Upload date:
  • Size: 350.1 kB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.3.1

File hashes

Hashes for finoptim-0.1.72-cp312-none-win32.whl
Algorithm Hash digest
SHA256 7ca5c1af5e66c3d53e6a822b0b0dd25dcf914bcfb1126988e9efea854fbb6fff
MD5 792f95ae89d406499d9f0ee7b0541f21
BLAKE2b-256 e2a41ce267524f329360b079aa1f88ff22c1ada74960e660263c2475be36b920

See more details on using hashes here.

File details

Details for the file finoptim-0.1.72-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for finoptim-0.1.72-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bda885cb18fbdd58582f9bd0d4920c1e4e28be79c06cd063b675c175538369bd
MD5 3619cc2e5caed6970e9d00324c519db6
BLAKE2b-256 34082deb61e8f629f282135faedd7a4a162f68fe3bc86856f47298f922645eea

See more details on using hashes here.

File details

Details for the file finoptim-0.1.72-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for finoptim-0.1.72-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 412ca98f281a8c324b76c77bce03fc6699ce247464073d9884d903c6e8d99818
MD5 f35897d35db91db54f45f7da45cb93ef
BLAKE2b-256 ad4b69cbeea744afe9377a374f508abab9e6abf06264fb05a9a16f51b47b3a6e

See more details on using hashes here.

File details

Details for the file finoptim-0.1.72-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.whl.

File metadata

File hashes

Hashes for finoptim-0.1.72-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 f0aa81fcf1d5673f9875bd03fc5eaed9bb8f4c07158f82f96408b108be5539f6
MD5 b12f70c491a883b96beccaea5f34c241
BLAKE2b-256 ea85435114382e61c4835b58e5ecc453cb65f7f555aa38597cf1fa9250ffe14b

See more details on using hashes here.

File details

Details for the file finoptim-0.1.72-cp311-none-win_amd64.whl.

File metadata

File hashes

Hashes for finoptim-0.1.72-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 21c8291e197c60414cd92873347150768fc7072c39ea132c1a9168574c1dfd07
MD5 4126bb5b15b772f33225878571f44222
BLAKE2b-256 c18d1ec1c10e297b03fcba6985cedf07bed770d6b2e0a2a1c344b9bfd561cf22

See more details on using hashes here.

File details

Details for the file finoptim-0.1.72-cp311-none-win32.whl.

File metadata

  • Download URL: finoptim-0.1.72-cp311-none-win32.whl
  • Upload date:
  • Size: 351.7 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.3.1

File hashes

Hashes for finoptim-0.1.72-cp311-none-win32.whl
Algorithm Hash digest
SHA256 ebd77f0a663cfbab8def37b79c62abe3fcd2511bdf941f18f65dd6939e9420b3
MD5 29144bbf963c8024151e05bcc326ba1c
BLAKE2b-256 42b9eb1db60f46e199509ab5a830b6d19d463c64cdf9945ae1228d6a37f698c8

See more details on using hashes here.

File details

Details for the file finoptim-0.1.72-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for finoptim-0.1.72-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f4c50f420b5d52c7a31424d00be5c7c938c40747a57d192aa125af276e5eec1b
MD5 a3eaf0ecfa0b00cf5fc19b9f5b2c340e
BLAKE2b-256 6cb9d4b4c97141dccf5779dfeb448ea8c146efffe93001ca22d7eb80302a42fc

See more details on using hashes here.

File details

Details for the file finoptim-0.1.72-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for finoptim-0.1.72-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5711a894ff1c2209f8dabcd16ed3381f4c13bf66ab583f8fd61ff5562cd56f13
MD5 7fa18d8b522a3f27be3631015104850f
BLAKE2b-256 84ffc7cfa754d169ae9a6d146d488f6a18a949d891e36fe4103885eac71f1b62

See more details on using hashes here.

File details

Details for the file finoptim-0.1.72-cp311-cp311-manylinux_2_12_i686.manylinux2010_i686.whl.

File metadata

File hashes

Hashes for finoptim-0.1.72-cp311-cp311-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 5734374e6b87e6b1d5571c8a0eb69464c5bda169082c25f2bdaedcad7d0da9f8
MD5 93884f6cddb8fbbe37376f3a1f39aeba
BLAKE2b-256 0d6403fd2b7ce3c64f033cc622a5b564f9fcaa7d742ae1cf745110436548794a

See more details on using hashes here.

File details

Details for the file finoptim-0.1.72-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for finoptim-0.1.72-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2ec4e526f31762e4b942a413660365179c35eb61891446bf987645279d78c90b
MD5 14f0ef5606a591af8c00e76bdb685c7c
BLAKE2b-256 8037f591d96c13286d3c5f484ace61f0041676179459bc1000ef931ad4bb1263

See more details on using hashes here.

File details

Details for the file finoptim-0.1.72-cp311-cp311-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for finoptim-0.1.72-cp311-cp311-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 58c12d125101a0fbeb1161a00f136d2052a31dc680b56292468398582f96e4f6
MD5 da7dbfa8a5b8f8022b95737a2c85f5ba
BLAKE2b-256 ff9cb50ad894ee034e95d938ef298def1a42d585da894f9d605e291e8970afdf

See more details on using hashes here.

File details

Details for the file finoptim-0.1.72-cp310-none-win_amd64.whl.

File metadata

File hashes

Hashes for finoptim-0.1.72-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 3ec03844d75aba451652789a8811b69fce93ccb1327cd308c9be05149dbfae4d
MD5 f2e8d4ed14f31387f2f85ecbbf398ab7
BLAKE2b-256 3296c490c1c9b1d0e878e4c0b2beed98281540500cf0715990c38be2f3e52327

See more details on using hashes here.

File details

Details for the file finoptim-0.1.72-cp310-none-win32.whl.

File metadata

  • Download URL: finoptim-0.1.72-cp310-none-win32.whl
  • Upload date:
  • Size: 351.7 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.3.1

File hashes

Hashes for finoptim-0.1.72-cp310-none-win32.whl
Algorithm Hash digest
SHA256 c9cd89840c6f5e817c2a88523588ef7f9b9aadfda2d777778fc3d98e98c385c0
MD5 459a5ae361b479e03beb0fe5dfbcc807
BLAKE2b-256 72a04dbc10def0913fdde8868731a555056c8adc67c4f038e3b6282fdf0300ed

See more details on using hashes here.

File details

Details for the file finoptim-0.1.72-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for finoptim-0.1.72-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8a30405adf2243a49595be6cb408ab42a7b7c5667ecceb28d512efc83407383c
MD5 9029d4ed948020644bb04915c9d41cde
BLAKE2b-256 d5279de59bdab7f5eebbcd90524c85cd1327277965ac11ffd48dfefe96af39ee

See more details on using hashes here.

File details

Details for the file finoptim-0.1.72-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for finoptim-0.1.72-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2ffa61c9063189c237dc3cbfa62d58e09fcdb0713ea455d422992551375b207a
MD5 8525474ce181a95798ad79ac68972362
BLAKE2b-256 09378aa2336b81365876eadf97f9a689091cfc59bf2132ac925fcee60d8f1dc1

See more details on using hashes here.

File details

Details for the file finoptim-0.1.72-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.whl.

File metadata

File hashes

Hashes for finoptim-0.1.72-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm Hash digest
SHA256 b8c484e7088273bea4524851423e380367f3a64d9ae24c4b5b1bdb3937e7f8ae
MD5 5b59e76e14d904bd8f45782a15cf36da
BLAKE2b-256 40ccb8699531c48d078d7956bca08e08f4d1c4d8257cc50013f58baf19e12962

See more details on using hashes here.

File details

Details for the file finoptim-0.1.72-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for finoptim-0.1.72-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 63d9ccc5c157f7f33c69a264712d323b44c253d7806b8f7b0f297fb3d6e7f040
MD5 7635037ee46bcb8263947960182e3499
BLAKE2b-256 934c5a597c55d509ff43e7f72524573adf51e61dfa4907a243d9f25013d28e1f

See more details on using hashes here.

File details

Details for the file finoptim-0.1.72-cp310-cp310-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for finoptim-0.1.72-cp310-cp310-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 8d2ce8277e8291894e375148f67488a9a054ac15423c2f45c1000b18eadcd119
MD5 80ab6c71d6633ebe5ac6df2447f06f4e
BLAKE2b-256 185a4a901dd4eca7f37505422645819271fe3e7cf582fa03dc4fed61a3f30fab

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page