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, so you can install it directly with pip.
pip install finoptim
It requires at least Python 3.10. The documentation is available on readthedoc at : xxxxxx (not possible with a private repo)
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
current_reservations = pd.DataFrame(...) # some query of yours
res = fp.optimise(predictions, prices, current_reservations)
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
- possibility to precise the period of the data in case it is not inferred correctly
- coverage must follow the same inputs as cost
- allow for long DataFrame as input
- the cost function should return a gradient when evaluated (save some compute)
- need to listen to keyboard interupt from Rust (harder than expected with multi threading)
- logging instead of printing, both in the ython and Rust sides
actual problems
- add in documentation that for now optimisation only works if you have RI < SP < OD
- compute the better step size to avoid waiting too long (more or less done, but not even necessary with the inertial optimiser)
- 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
if the problem is $f(w) = \frac{1}{2} w^T A w :-: b^T w$ then the optimal parameters for the inertial optimiser are :
$$ \alpha = \left(\frac{2}{\sqrt{\lambda_1} + \sqrt{\lambda_n}} \right) ^2 $$
$$ \beta = \left( \frac{\sqrt{\lambda_n} - \sqrt{\lambda_1}}{\sqrt{\lambda_1} + \sqrt{\lambda_n}} \right) ^2 $$
with $\lambda_1$ and $\lambda_n$ respectively the smallest and largest eigenvalues of $A$
lets admit constant usage for all the instances. Then $f(w) = $
Project size
wc -l src/finoptim/*.py rust/src/*.rs src/finoptim/prices/*.py tests/*.py
is around 3k lines of code
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file finoptim-0.1.52.tar.gz
.
File metadata
- Download URL: finoptim-0.1.52.tar.gz
- Upload date:
- Size: 31.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7df72f443567f24a3755275916f4e60c841c5d6a5f69b89ca1b4f5724b19e38a |
|
MD5 | 2a342084441d7476d6f8dfff7d202bd1 |
|
BLAKE2b-256 | 2c8e2fad4452ba21f103954ebf831c8097708e1e5f3e0de2583ee969ef28fcb4 |
File details
Details for the file finoptim-0.1.52-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: finoptim-0.1.52-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: PyPy, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99999fa0d57403f08c76fa216031a172075f35334f49dfc66378b20433702ee1 |
|
MD5 | f9678288cfb1394bd59916bd03bdd21f |
|
BLAKE2b-256 | dbe391fb9d9dd7984e7c1431a960446fa864407919f145ff5ee1354f97803247 |
File details
Details for the file finoptim-0.1.52-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: finoptim-0.1.52-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.4 MB
- Tags: PyPy, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25b21dee0c926950dcc4ecb35952f1353e0c7e4af148b2584e3ec428db4c556a |
|
MD5 | 21fb36e78cfae5ff8ef3ad64a27f67a6 |
|
BLAKE2b-256 | 2c97e649ff9ec99fabe8207a14f07850a00ad9313ec6b29d569e3ea59b71e481 |
File details
Details for the file finoptim-0.1.52-pp310-pypy310_pp73-manylinux_2_12_i686.manylinux2010_i686.whl
.
File metadata
- Download URL: finoptim-0.1.52-pp310-pypy310_pp73-manylinux_2_12_i686.manylinux2010_i686.whl
- Upload date:
- Size: 1.4 MB
- Tags: PyPy, manylinux: glibc 2.12+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f667f9c5a4c743e512168b0d806b4996d0e565c768efbf0bdb2a0685215f1a3 |
|
MD5 | 0dd79e021de6bf1788110a9e024e6a0c |
|
BLAKE2b-256 | ae47a5ada97d705ba98ffe02d27ef61f2ec365c4f08eba1ae023ea48549ca322 |
File details
Details for the file finoptim-0.1.52-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: finoptim-0.1.52-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6a928ab24f28fafe384eab824aa71c4a8214f8c03d33973bbc4ebb945316f61 |
|
MD5 | 963ef07bc676d05fbe08cd30c6f6d833 |
|
BLAKE2b-256 | 79a61b202975acb14979bab300fb7fab6dc4eca4d246eb8231d9d461078ddefe |
File details
Details for the file finoptim-0.1.52-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: finoptim-0.1.52-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0dc36d7545bf66efad36736230c99694d59b9daedc889467808989156e605865 |
|
MD5 | c8ece51e9e4657f9da466419bf052c9b |
|
BLAKE2b-256 | a82fe3a3d57ef97874fa3a57ca93fd622f207633844adc1800074d3c3cfa9901 |
File details
Details for the file finoptim-0.1.52-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.whl
.
File metadata
- Download URL: finoptim-0.1.52-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.12, manylinux: glibc 2.12+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24aa18307a3e8c53b002534238e54722a3036f06062bab2e059c57d6582a2279 |
|
MD5 | e617642ef1906c8212cc820f99272ce3 |
|
BLAKE2b-256 | b5d906fb2d5f22d3efdaa731818ee7f22ef5a85ddc10dd1d6a7d72834e6de293 |
File details
Details for the file finoptim-0.1.52-cp311-none-win_amd64.whl
.
File metadata
- Download URL: finoptim-0.1.52-cp311-none-win_amd64.whl
- Upload date:
- Size: 394.7 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f945b622a5ce1eecf997b7ce48617a533fd5783cf6273c8a8ceb5cdce8d6a17 |
|
MD5 | 6de988a12ebd75d4e053aed389824134 |
|
BLAKE2b-256 | 93ab4f78d7a63c9face2ade987fe431bbb5a35a3dadc458c265f373f0308b820 |
File details
Details for the file finoptim-0.1.52-cp311-none-win32.whl
.
File metadata
- Download URL: finoptim-0.1.52-cp311-none-win32.whl
- Upload date:
- Size: 351.2 kB
- Tags: CPython 3.11, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5d3f1ffb6d0b960bd7e003bb7c5607be6e5d556e0250a7a8a90a41ef1d5beac |
|
MD5 | 2142d4f6b16dc7a1efe3dee4387673b5 |
|
BLAKE2b-256 | 3988d8645a24732e895439127035df205def9a2f731526953d0fab18cac472f7 |
File details
Details for the file finoptim-0.1.52-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: finoptim-0.1.52-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1f0543d48e6e8ddbd0414ec127c338f6cb1663bdbf237da7133c417fafffcd9 |
|
MD5 | 8e735552db7f74353f1f472b6e658ae7 |
|
BLAKE2b-256 | cb157f294c4eedfa6d947225fa874600a073db9fe169d0fda9a83ebb0c99756e |
File details
Details for the file finoptim-0.1.52-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: finoptim-0.1.52-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.11, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9dd94965e18411eb73eb37ec7c731e546ccfbf825705f27ddad4eb7eaf91f7e9 |
|
MD5 | abe19b483259ba2f4b55f6f40cce666e |
|
BLAKE2b-256 | d14f0dce2e1eeae37425bc97a3257dd5e0ad1b70f3cd2d046981c9fcdd5c317a |
File details
Details for the file finoptim-0.1.52-cp311-cp311-manylinux_2_12_i686.manylinux2010_i686.whl
.
File metadata
- Download URL: finoptim-0.1.52-cp311-cp311-manylinux_2_12_i686.manylinux2010_i686.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.11, manylinux: glibc 2.12+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1884137bc57c4bf46e73d30f764b26768154ac9cec0269a98eabba7429c6ec54 |
|
MD5 | b15d3f32c1c3f52e71c30080c858a2f1 |
|
BLAKE2b-256 | 60c1d73038e35f9ee8e6662b0b200403817a1b41d42c45a057fb3309ff67c2c4 |
File details
Details for the file finoptim-0.1.52-cp311-cp311-macosx_11_0_arm64.whl
.
File metadata
- Download URL: finoptim-0.1.52-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 496.7 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8024b78fd5c305d853df86ad1acaabe644b683d041d98469ee52a10bac3c883c |
|
MD5 | 4051952a7f06c7f6a8f68203c624a441 |
|
BLAKE2b-256 | f008be9cd9c91ef97a191c69bda47bd223bfe00ef82351ef8079b2ec397c03da |
File details
Details for the file finoptim-0.1.52-cp311-cp311-macosx_10_7_x86_64.whl
.
File metadata
- Download URL: finoptim-0.1.52-cp311-cp311-macosx_10_7_x86_64.whl
- Upload date:
- Size: 551.6 kB
- Tags: CPython 3.11, macOS 10.7+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5510b737784290b28323b55c2812b21a67ca76fc169a4b5581bd8565c4264130 |
|
MD5 | c5e19b1a259bd85c4e10e1642d475ead |
|
BLAKE2b-256 | ef29f5869e1c9ddf0a5bce7933a30c497a9ad4acfe28ecb0e57891e4f10dfee6 |
File details
Details for the file finoptim-0.1.52-cp310-none-win_amd64.whl
.
File metadata
- Download URL: finoptim-0.1.52-cp310-none-win_amd64.whl
- Upload date:
- Size: 394.6 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | efbcb9477bd033c7073b9ea411dc1ad4fd8bd6444fb187d7579c44b502ad7a98 |
|
MD5 | d9f871f79a65c7bd3238e3ea9b1725db |
|
BLAKE2b-256 | 77869be073dbff87a16b26747777857cfc7c4042c189980b5b42e769e3f0eee0 |
File details
Details for the file finoptim-0.1.52-cp310-none-win32.whl
.
File metadata
- Download URL: finoptim-0.1.52-cp310-none-win32.whl
- Upload date:
- Size: 351.1 kB
- Tags: CPython 3.10, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1bf008b3065da658607161c2c80fb03bc6b4066b67e7292de91db0014539bac |
|
MD5 | 36e6e8ecb76a0b0779ac49af0e103d2c |
|
BLAKE2b-256 | 3f6c964813e09730c3b93aa1a431cc0476452459db10dca0de2df8288c16bc52 |
File details
Details for the file finoptim-0.1.52-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: finoptim-0.1.52-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | befb484c25fbcb1a67bc0f6c60efd77bd48b1658869ef8b37812f5814657940a |
|
MD5 | 54005ef9786ccb8f47d4646bd270e0ac |
|
BLAKE2b-256 | 1bb53be7f4eed24abf303db63751bd817a0a4da2f3ebc4a45a697b802ac39881 |
File details
Details for the file finoptim-0.1.52-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
.
File metadata
- Download URL: finoptim-0.1.52-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.10, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd5b8ffb2f61e6ed93e0ea4a694dd30112fa40916208c18cc5c96f56f6f75158 |
|
MD5 | 1dbd5726d2b80f2d6459a40fdfa76120 |
|
BLAKE2b-256 | a2e3686cd36585117475022535a2ea6fc6caa27ce9b28af34401e18b8ab6e145 |
File details
Details for the file finoptim-0.1.52-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.whl
.
File metadata
- Download URL: finoptim-0.1.52-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.10, manylinux: glibc 2.12+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84b2eb410aca6951ca1f1b871ebc79cbef266d80f392a04df0f62282b0afc57a |
|
MD5 | c728ff1ef13a570c3a31bb055cf9a422 |
|
BLAKE2b-256 | 2173e246d763b4847325797bd92a6e99f60d0b998f6eb6424d1b46fc6c410527 |
File details
Details for the file finoptim-0.1.52-cp310-cp310-macosx_11_0_arm64.whl
.
File metadata
- Download URL: finoptim-0.1.52-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 496.7 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 33e74c7a0197e79124715d3f4e3a8ce101af47644d0b9674a51ea7870fd407b6 |
|
MD5 | e73831f0e5220e27b26b16256ab42f83 |
|
BLAKE2b-256 | ef1d788f7de9f0bc378be3ca6820971d236b1af2dd06f86240caa4614d3a3028 |
File details
Details for the file finoptim-0.1.52-cp310-cp310-macosx_10_7_x86_64.whl
.
File metadata
- Download URL: finoptim-0.1.52-cp310-cp310-macosx_10_7_x86_64.whl
- Upload date:
- Size: 551.6 kB
- Tags: CPython 3.10, macOS 10.7+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.2.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f080c78b69d4cb8ec8a97dd86a830a6678f8a5605ee6870408f2c4b53c9012d |
|
MD5 | 8605a4032fe1c9a89c552afa7ff39a64 |
|
BLAKE2b-256 | 8fe67d1bfb40d82fca157351fd89d0cd3de745190b076b7a550ab7b6a12a3731 |