Add synthApi (#27)
* Add synthApi * Put confidence for Synth proba * Update the code * Update readme * Fix bootstraping * fix github build * Update the endpoints for scenario * Add scenario and update backtest modal * Update bot modal * Update interfaces for synth * add synth to backtest * Add Kelly criterion and better signal * Update signal confidence * update doc * save leaderboard and prediction * Update nswag to generate ApiClient in the correct path * Unify the trading modal * Save miner and prediction * Update messaging and block new signal until position not close when flipping off * Rename strategies to indicators * Update doc * Update chart + add signal name * Fix signal direction * Update docker webui * remove crypto npm * Clean
This commit is contained in:
@@ -7,6 +7,25 @@ using NSwag.CodeGeneration.TypeScript;
|
||||
|
||||
var document = OpenApiDocument.FromUrlAsync(("http://localhost:5000/swagger/v1/swagger.json")).Result;
|
||||
|
||||
// Get the solution directory by going up from the current executable location
|
||||
var currentDirectory = Directory.GetCurrentDirectory();
|
||||
var solutionDirectory = currentDirectory;
|
||||
|
||||
// Navigate up until we find the src directory or reach a reasonable limit
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
if (Directory.Exists(Path.Combine(solutionDirectory, "src")))
|
||||
break;
|
||||
|
||||
var parent = Directory.GetParent(solutionDirectory);
|
||||
if (parent == null)
|
||||
break;
|
||||
solutionDirectory = parent.FullName;
|
||||
}
|
||||
|
||||
var targetDirectory = Path.Combine(solutionDirectory, "src", "Managing.WebApp", "src", "generated");
|
||||
Directory.CreateDirectory(targetDirectory); // Ensure the directory exists
|
||||
|
||||
var settings = new TypeScriptClientGeneratorSettings
|
||||
{
|
||||
ClassName = "{controller}Client",
|
||||
@@ -30,7 +49,27 @@ var settings = new TypeScriptClientGeneratorSettings
|
||||
|
||||
var generatorApiClient = new TypeScriptClientGenerator(document, settings);
|
||||
var codeApiClient = generatorApiClient.GenerateFile();
|
||||
File.WriteAllText("ManagingApi.ts", codeApiClient);
|
||||
|
||||
// Add the necessary imports after the auto-generated comment
|
||||
var requiredImports = @"
|
||||
import AuthorizedApiBase from ""./AuthorizedApiBase"";
|
||||
import IConfig from ""./IConfig"";
|
||||
";
|
||||
|
||||
// Find the end of the auto-generated comment and insert imports
|
||||
var autoGeneratedEndIndex = codeApiClient.IndexOf("//----------------------");
|
||||
if (autoGeneratedEndIndex != -1)
|
||||
{
|
||||
// Find the second occurrence (end of the comment block)
|
||||
autoGeneratedEndIndex = codeApiClient.IndexOf("//----------------------", autoGeneratedEndIndex + 1);
|
||||
if (autoGeneratedEndIndex != -1)
|
||||
{
|
||||
autoGeneratedEndIndex = codeApiClient.IndexOf("\n", autoGeneratedEndIndex) + 1;
|
||||
codeApiClient = codeApiClient.Insert(autoGeneratedEndIndex, requiredImports);
|
||||
}
|
||||
}
|
||||
|
||||
File.WriteAllText(Path.Combine(targetDirectory, "ManagingApi.ts"), codeApiClient);
|
||||
|
||||
var settingsTypes = new TypeScriptClientGeneratorSettings
|
||||
{
|
||||
@@ -53,4 +92,4 @@ var settingsTypes = new TypeScriptClientGeneratorSettings
|
||||
|
||||
var generatorTypes = new TypeScriptClientGenerator(document, settingsTypes);
|
||||
var codeTypes = generatorTypes.GenerateFile();
|
||||
File.WriteAllText("ManagingApiTypes.ts", codeTypes);
|
||||
File.WriteAllText(Path.Combine(targetDirectory, "ManagingApiTypes.ts"), codeTypes);
|
||||
Reference in New Issue
Block a user