PoolzRanking 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package PoolzRanking --version 1.0.0                
NuGet\Install-Package PoolzRanking -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PoolzRanking" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PoolzRanking --version 1.0.0                
#r "nuget: PoolzRanking, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install PoolzRanking as a Cake Addin
#addin nuget:?package=PoolzRanking&version=1.0.0

// Install PoolzRanking as a Cake Tool
#tool nuget:?package=PoolzRanking&version=1.0.0                

PoolzRanking

Overview

PoolzRanking is a .NET library for calculating a ranking system based on provided key-value pairs of addresses and amounts. The ranking system uses a top-down weighting system to distribute an allocation of funds based on user ranking.

Usage

To use PoolzRanking in your .NET project, simply install the package from NuGet:

Install-Package PoolzRanking -Version 1.0.0

You can then use the library by importing the PoolzRanking namespace and creating an instance of the RankingModel class:

using PoolzRanking;

var keyValuePairs = new Dictionary<string, decimal>
{
    { "Address1", 100m },
    { "Address2", 200m },
    { "Address3", 300m },
};

var totalAllocation = 1000m;
var top = 0.5m;
var bottom = 0.1m;

var rankingModel = new RankingModel(keyValuePairs, totalAllocation, top, bottom);
var results = rankingModel.GetResults();

Get the Results

To get the ranked results, call the GetResults method on the RankingModel instance:

var results = model.GetResults();

The results variable will contain a list of ResultItem instances, which have the following properties:

Address: The address of the item. Amount: The value of the item. Allocation: The allocation that the item should receive.

Create Random Winners

To create random winners from a list of sign-ups, create a list of SignUp instances, and pass it to the RandomWinners constructor:

var signUps = new List<SignUp>
{
    new SignUp { Address = "Alice", Amount = 10m },
    new SignUp { Address = "Bob", Amount = 20m },
    new SignUp { Address = "Charlie", Amount = 30m },
    new SignUp { Address = "David", Amount = 40m },
    new SignUp { Address = "Eve", Amount = 50m },
};

var min = 50m;
var take = 2;
var set = 100m;

var randomWinners = new RandomWinners(signUps, min, take, set);

The randomWinners.Results property will contain a list of ResultItem instances, which have the following properties:

Address: The address of the item. Amount: The value of the item. Allocation: The allocation that the item should receive.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3 2,105 4/28/2023
1.0.2 475 4/24/2023
1.0.1 187 4/24/2023
1.0.0 245 4/23/2023