🚀
Finter
PlaygroundData Catalogue
Quick Start
Quick Start
  • Getting Started with Finter: A Quick Guide
  • Explore Finter
    • Finter Labs (Recommended)
    • Other Ways
      • Google Colab
      • Conda, venv, or Docker
      • Setting Up a .env File (Optional)
  • Framework
    • CM (Content Model)
    • AM (Alpha Model)
    • PM (Portfolio Model)
    • Simulatior
      • Target Volume Limit
    • Finter Cli Submission
      • Validation
      • GitHub Sync
      • [Legacy] JupyterLab Submission
      • [Legacy] Submission
  • MODELING
    • MetaPortfolio
      • Equal weight meta portfolio
      • Fixed weight meta portfolio
      • Risk parity meta portfolio
    • StrategicAssetAllocation
    • DateConverter
    • BuyHoldConverter
  • Supporting Tools
    • FileManager
    • Finter AI (alpha ver.)
    • Data
      • FinHelper
        • filter_unchanged
        • unify_idx
        • shift_fundamental
        • rolling
        • expand_to_gvkeyiid
      • ModelData
      • ID Table
      • ID Converter
      • Quanda Data
    • Evaluator
      • top_n_assets
      • bottom_n_assets
      • compare_with_bm
    • PortfolioAnalyzer
    • Email
Powered by GitBook
On this page
  • Usage
  • Implement the FileManager in Your Class

Was this helpful?

Edit on GitHub
  1. Supporting Tools

FileManager

The FileManager feature simplifies the use of local files with relative paths, ensuring compatibility across different environments (server and client).

Usage

Implement the FileManager in Your Class

In your class, declare the file_path using the FileManager.get_path method. This method allows you to specify a relative file path, which will be appropriately adjusted for the running environment.

from finter.utils import FileManager
from finter import BaseAlpha
import pandas as pd

class Alpha(BaseAlpha):  
    # Declare the file path using FileManager
    file_path = FileManager.get_path('hi.csv')

    def get(self, start, end):        
        import pandas as pd
        print(self.file_path)
        df = pd.read_csv(self.file_path, index_col=0)
        print(df)

        return pd.DataFrame([1, 2, 3])

Warning

  • Class Variable Declaration: Ensure the file_path is declared as a class variable, not within the __init__ method.

  • Experimental Feature: This feature is currently in the research phase and can be used for validation purposes. However, it does not guarantee production-level reliability.

By following these simple steps, you can efficiently manage local files with FileManager.

Last updated 10 months ago

Was this helpful?